CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
ElectronEnergyRegressionEvaluate Class Reference

#include <ElectronEnergyRegressionEvaluate.h>

Public Types

enum  ElectronEnergyRegressionType {
  kNoTrkVar, kNoTrkVarV1, kWithTrkVar, kWithTrkVarV1,
  kWithTrkVarV2, kWithSubCluVar
}
 

Public Member Functions

double calculateRegressionEnergy (const reco::GsfElectron *ele, SuperClusterHelper &mySCHelper, double rho, double nvertices, bool printDebug=false)
 
double calculateRegressionEnergyUncertainty (const reco::GsfElectron *ele, SuperClusterHelper &mySCHelper, double rho, double nvertices, bool printDebug=false)
 
 ElectronEnergyRegressionEvaluate ()
 
void initialize (std::string weightsFile, ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType type)
 
bool isInitialized () const
 
double regressionUncertaintyNoTrkVar (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
 
double regressionUncertaintyNoTrkVarV1 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, bool printDebug=false)
 
double regressionUncertaintyWithSubClusters (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
 
double regressionUncertaintyWithTrkVar (double electronP, double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double pt, double GsfTrackPIn, double fbrem, double Charge, double EoP, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
 
double regressionUncertaintyWithTrkVarV1 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, bool printDebug=false)
 
double regressionUncertaintyWithTrkVarV1 (std::vector< double > &inputvars, bool printDebug=false)
 
double regressionUncertaintyWithTrkVarV2 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, double detaIn, double dphiIn, double detaCalo, double dphiCalo, double GsfTrackChiSqr, double KFTrackNLayers, double ElectronEnergyOverPout, bool printDebug=false)
 
double regressionUncertaintyWithTrkVarV2 (std::vector< double > &inputvars, bool printDebug=false)
 
double regressionValueNoTrkVar (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
 
double regressionValueNoTrkVarV1 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, bool printDebug=false)
 
double regressionValueWithSubClusters (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
 
double regressionValueWithTrkVar (double electronP, double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double pt, double GsfTrackPIn, double fbrem, double Charge, double EoP, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
 
double regressionValueWithTrkVarV1 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, bool printDebug=false)
 
double regressionValueWithTrkVarV1 (std::vector< double > &inputvars, bool printDebug=false)
 
double regressionValueWithTrkVarV2 (double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, double detaIn, double dphiIn, double detaCalo, double dphiCalo, double GsfTrackChiSqr, double KFTrackNLayers, double ElectronEnergyOverPout, bool printDebug=false)
 
double regressionValueWithTrkVarV2 (std::vector< double > &inputvars, bool printDebug=false)
 
 ~ElectronEnergyRegressionEvaluate ()
 

Private Attributes

bool fIsInitialized
 
GBRForestforestCorrection_eb
 
GBRForestforestCorrection_ee
 
GBRForestforestUncertainty_eb
 
GBRForestforestUncertainty_ee
 
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
 

Detailed Description

–> NOTE if you want to use this class as standalone without the CMSSW part you need to uncomment the below line and compile normally with scramv1 b Then you need just to load it in your root macro the lib with the correct path, eg: gSystem->Load("/data/benedet/CMSSW_5_2_2/lib/slc5_amd64_gcc462/pluginEGammaEGammaAnalysisTools.so");

Definition at line 35 of file ElectronEnergyRegressionEvaluate.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionEvaluate ( )
ElectronEnergyRegressionEvaluate::~ElectronEnergyRegressionEvaluate ( )

Definition at line 25 of file ElectronEnergyRegressionEvaluate.cc.

25 {}

Member Function Documentation

double ElectronEnergyRegressionEvaluate::calculateRegressionEnergy ( const reco::GsfElectron ele,
SuperClusterHelper mySCHelper,
double  rho,
double  nvertices,
bool  printDebug = false 
)

Definition at line 55 of file ElectronEnergyRegressionEvaluate.cc.

References reco::LeafCandidate::charge(), reco::GsfElectron::classification(), reco::GsfElectron::closestCtfTrackRef(), SuperClusterHelper::clustersSize(), reco::GsfElectron::correctedEcalEnergyError(), gather_cfg::cout, reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), SuperClusterHelper::e2nd(), SuperClusterHelper::e2x5Bottom(), SuperClusterHelper::e2x5Left(), SuperClusterHelper::e2x5Max(), SuperClusterHelper::e2x5Right(), SuperClusterHelper::e2x5Top(), SuperClusterHelper::e3x3(), SuperClusterHelper::e5x5(), SuperClusterHelper::eBottom(), reco::GsfElectron::ecalDrivenSeed(), reco::GsfElectron::eEleClusterOverPout(), SuperClusterHelper::eESClusters(), SuperClusterHelper::eLeft(), SuperClusterHelper::eMax(), SuperClusterHelper::eRight(), SuperClusterHelper::esClusterEnergy(), SuperClusterHelper::esClusterEta(), SuperClusterHelper::esClusterPhi(), SuperClusterHelper::eSubClusters(), reco::GsfElectron::eSuperClusterOverP(), SuperClusterHelper::eta(), reco::LeafCandidate::eta(), SuperClusterHelper::etaCrySeed(), SuperClusterHelper::etaWidth(), SuperClusterHelper::eTop(), reco::GsfElectron::fbrem(), fIsInitialized, fVersionType, reco::GsfElectron::gsfTrack(), SuperClusterHelper::hadronicOverEm(), SuperClusterHelper::ietaSeed(), SuperClusterHelper::iphiSeed(), reco::GsfElectron::isEB(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEEDeeGap(), edm::Ref< C, T, F >::isNonnull(), kNoTrkVar, kNoTrkVarV1, kWithSubCluVar, kWithTrkVarV1, kWithTrkVarV2, SuperClusterHelper::nPreshowerClusters(), reco::LeafCandidate::p(), SuperClusterHelper::phi(), reco::LeafCandidate::phi(), SuperClusterHelper::phiCrySeed(), SuperClusterHelper::phiWidth(), SuperClusterHelper::preshowerEnergyOverRaw(), SQLiteCheck_cfg::printDebug, reco::LeafCandidate::pt(), SuperClusterHelper::r9(), SuperClusterHelper::rawEnergy(), regressionValueNoTrkVar(), regressionValueNoTrkVarV1(), regressionValueWithSubClusters(), regressionValueWithTrkVarV1(), regressionValueWithTrkVarV2(), rho, SuperClusterHelper::seedEnergy(), SuperClusterHelper::seedEta(), SuperClusterHelper::seedPhi(), SuperClusterHelper::sep(), SuperClusterHelper::sigmaIetaIeta(), SuperClusterHelper::spp(), SuperClusterHelper::subClusterE3x3(), SuperClusterHelper::subClusterEmax(), SuperClusterHelper::subClusterEnergy(), SuperClusterHelper::subClusterEta(), SuperClusterHelper::subClusterPhi(), reco::GsfElectron::trackMomentumAtVtx(), and reco::GsfElectron::trackMomentumError().

58  {
59 
60  if (!fIsInitialized) {
61  std::cout << "Error: Electron Energy Regression has not been initialized yet. return 0. \n";
62  return 0;
63  }
64 
65 
66  if (printDebug) {
67  std::cout << "Regression Type: " << fVersionType << std::endl;
68  std::cout << "Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n";
69  }
70 
71  if (fVersionType == kNoTrkVar) {
73  mySCHelper.rawEnergy(),
74  mySCHelper.eta(),
75  mySCHelper.phi(),
76  mySCHelper.r9(),
77  mySCHelper.etaWidth(),
78  mySCHelper.phiWidth(),
79  mySCHelper.clustersSize(),
80  mySCHelper.hadronicOverEm(),
81  rho,
82  nvertices,
83  mySCHelper.seedEta(),
84  mySCHelper.seedPhi(),
85  mySCHelper.seedEnergy(),
86  mySCHelper.e3x3(),
87  mySCHelper.e5x5(),
88  mySCHelper.sigmaIetaIeta(),
89  mySCHelper.spp(),
90  mySCHelper.sep(),
91  mySCHelper.eMax(),
92  mySCHelper.e2nd(),
93  mySCHelper.eTop(),
94  mySCHelper.eBottom(),
95  mySCHelper.eLeft(),
96  mySCHelper.eRight(),
97  mySCHelper.e2x5Max(),
98  mySCHelper.e2x5Top(),
99  mySCHelper.e2x5Bottom(),
100  mySCHelper.e2x5Left(),
101  mySCHelper.e2x5Right(),
102  mySCHelper.ietaSeed(),
103  mySCHelper.iphiSeed(),
104  mySCHelper.etaCrySeed(),
105  mySCHelper.phiCrySeed(),
106  mySCHelper.preshowerEnergyOverRaw(),
107  printDebug
108  );
109  }
110  if (fVersionType == kWithSubCluVar) {
112  mySCHelper.rawEnergy(),
113  mySCHelper.eta(),
114  mySCHelper.phi(),
115  mySCHelper.r9(),
116  mySCHelper.etaWidth(),
117  mySCHelper.phiWidth(),
118  mySCHelper.clustersSize(),
119  mySCHelper.hadronicOverEm(),
120  rho,
121  nvertices,
122  mySCHelper.seedEta(),
123  mySCHelper.seedPhi(),
124  mySCHelper.seedEnergy(),
125  mySCHelper.e3x3(),
126  mySCHelper.e5x5(),
127  mySCHelper.sigmaIetaIeta(),
128  mySCHelper.spp(),
129  mySCHelper.sep(),
130  mySCHelper.eMax(),
131  mySCHelper.e2nd(),
132  mySCHelper.eTop(),
133  mySCHelper.eBottom(),
134  mySCHelper.eLeft(),
135  mySCHelper.eRight(),
136  mySCHelper.e2x5Max(),
137  mySCHelper.e2x5Top(),
138  mySCHelper.e2x5Bottom(),
139  mySCHelper.e2x5Left(),
140  mySCHelper.e2x5Right(),
141  mySCHelper.ietaSeed(),
142  mySCHelper.iphiSeed(),
143  mySCHelper.etaCrySeed(),
144  mySCHelper.phiCrySeed(),
145  mySCHelper.preshowerEnergyOverRaw(),
146  ele->ecalDrivenSeed(),
147  ele->isEBEtaGap(),
148  ele->isEBPhiGap(),
149  ele->isEEDeeGap(),
150  mySCHelper.eSubClusters(),
151  mySCHelper.subClusterEnergy(1),
152  mySCHelper.subClusterEta(1),
153  mySCHelper.subClusterPhi(1),
154  mySCHelper.subClusterEmax(1),
155  mySCHelper.subClusterE3x3(1),
156  mySCHelper.subClusterEnergy(2),
157  mySCHelper.subClusterEta(2),
158  mySCHelper.subClusterPhi(2),
159  mySCHelper.subClusterEmax(2),
160  mySCHelper.subClusterE3x3(2),
161  mySCHelper.subClusterEnergy(3),
162  mySCHelper.subClusterEta(3),
163  mySCHelper.subClusterPhi(3),
164  mySCHelper.subClusterEmax(3),
165  mySCHelper.subClusterE3x3(3),
166  mySCHelper.nPreshowerClusters(),
167  mySCHelper.eESClusters(),
168  mySCHelper.esClusterEnergy(0),
169  mySCHelper.esClusterEta(0),
170  mySCHelper.esClusterPhi(0),
171  mySCHelper.esClusterEnergy(1),
172  mySCHelper.esClusterEta(1),
173  mySCHelper.esClusterPhi(1),
174  mySCHelper.esClusterEnergy(2),
175  mySCHelper.esClusterEta(2),
176  mySCHelper.esClusterPhi(2),
177  ele->isEB(),
178  printDebug
179  );
180  }
181  else if (fVersionType == kNoTrkVarV1) {
183  mySCHelper.rawEnergy(),
184  mySCHelper.eta(),
185  mySCHelper.phi(),
186  mySCHelper.r9(),
187  mySCHelper.etaWidth(),
188  mySCHelper.phiWidth(),
189  mySCHelper.clustersSize(),
190  mySCHelper.hadronicOverEm(),
191  rho,
192  nvertices,
193  mySCHelper.seedEta(),
194  mySCHelper.seedPhi(),
195  mySCHelper.seedEnergy(),
196  mySCHelper.e3x3(),
197  mySCHelper.e5x5(),
198  mySCHelper.sigmaIetaIeta(),
199  mySCHelper.spp(),
200  mySCHelper.sep(),
201  mySCHelper.eMax(),
202  mySCHelper.e2nd(),
203  mySCHelper.eTop(),
204  mySCHelper.eBottom(),
205  mySCHelper.eLeft(),
206  mySCHelper.eRight(),
207  mySCHelper.e2x5Max(),
208  mySCHelper.e2x5Top(),
209  mySCHelper.e2x5Bottom(),
210  mySCHelper.e2x5Left(),
211  mySCHelper.e2x5Right(),
212  mySCHelper.ietaSeed(),
213  mySCHelper.iphiSeed(),
214  mySCHelper.etaCrySeed(),
215  mySCHelper.phiCrySeed(),
216  mySCHelper.preshowerEnergyOverRaw(),
217  ele->ecalDrivenSeed(),
218  printDebug
219  );
220  }
221  else if (fVersionType == kWithTrkVarV1) {
223  mySCHelper.rawEnergy(),
224  mySCHelper.eta(),
225  mySCHelper.phi(),
226  mySCHelper.r9(),
227  mySCHelper.etaWidth(),
228  mySCHelper.phiWidth(),
229  mySCHelper.clustersSize(),
230  mySCHelper.hadronicOverEm(),
231  rho,
232  nvertices,
233  mySCHelper.seedEta(),
234  mySCHelper.seedPhi(),
235  mySCHelper.seedEnergy(),
236  mySCHelper.e3x3(),
237  mySCHelper.e5x5(),
238  mySCHelper.sigmaIetaIeta(),
239  mySCHelper.spp(),
240  mySCHelper.sep(),
241  mySCHelper.eMax(),
242  mySCHelper.e2nd(),
243  mySCHelper.eTop(),
244  mySCHelper.eBottom(),
245  mySCHelper.eLeft(),
246  mySCHelper.eRight(),
247  mySCHelper.e2x5Max(),
248  mySCHelper.e2x5Top(),
249  mySCHelper.e2x5Bottom(),
250  mySCHelper.e2x5Left(),
251  mySCHelper.e2x5Right(),
252  mySCHelper.ietaSeed(),
253  mySCHelper.iphiSeed(),
254  mySCHelper.etaCrySeed(),
255  mySCHelper.phiCrySeed(),
256  mySCHelper.preshowerEnergyOverRaw(),
257  ele->ecalDrivenSeed(),
258  ele->trackMomentumAtVtx().R(),
259  fmax(ele->fbrem(),-1.0),
260  ele->charge(),
261  fmin(ele->eSuperClusterOverP(), 20.0),
262  ele->trackMomentumError(),
264  ele->classification(),
265  printDebug
266  );
267  }
268  else if (fVersionType == kWithTrkVarV2) {
270  mySCHelper.rawEnergy(),
271  mySCHelper.eta(),
272  mySCHelper.phi(),
273  mySCHelper.r9(),
274  mySCHelper.etaWidth(),
275  mySCHelper.phiWidth(),
276  mySCHelper.clustersSize(),
277  mySCHelper.hadronicOverEm(),
278  rho,
279  nvertices,
280  mySCHelper.seedEta(),
281  mySCHelper.seedPhi(),
282  mySCHelper.seedEnergy(),
283  mySCHelper.e3x3(),
284  mySCHelper.e5x5(),
285  mySCHelper.sigmaIetaIeta(),
286  mySCHelper.spp(),
287  mySCHelper.sep(),
288  mySCHelper.eMax(),
289  mySCHelper.e2nd(),
290  mySCHelper.eTop(),
291  mySCHelper.eBottom(),
292  mySCHelper.eLeft(),
293  mySCHelper.eRight(),
294  mySCHelper.e2x5Max(),
295  mySCHelper.e2x5Top(),
296  mySCHelper.e2x5Bottom(),
297  mySCHelper.e2x5Left(),
298  mySCHelper.e2x5Right(),
299  mySCHelper.ietaSeed(),
300  mySCHelper.iphiSeed(),
301  mySCHelper.etaCrySeed(),
302  mySCHelper.phiCrySeed(),
303  mySCHelper.preshowerEnergyOverRaw(),
304  ele->ecalDrivenSeed(),
305  ele->trackMomentumAtVtx().R(),
306  fmax(ele->fbrem(),-1.0),
307  ele->charge(),
308  fmin(ele->eSuperClusterOverP(), 20.0),
309  ele->trackMomentumError(),
311  ele->classification(),
312  fmin(fabs(ele->deltaEtaSuperClusterTrackAtVtx()), 0.6),
316  ele->gsfTrack()->chi2() / ele->gsfTrack()->ndof(),
317  (ele->closestCtfTrackRef().isNonnull() ? ele->closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1),
318  fmin(ele->eEleClusterOverPout(),20.0),
319  printDebug
320  );
321  }
322  else {
323  std::cout << "Warning: Electron Regression Type " << fVersionType << " is not supported. Reverting to default electron momentum.\n";
324  return ele->p();
325  }
326 
327 
328 }
float trackMomentumError() const
Definition: GsfElectron.h:728
double regressionValueNoTrkVarV1(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, bool printDebug=false)
float eESClusters() const
float e2x5Max() const
bool isEBEtaGap() const
Definition: GsfElectron.h:338
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
virtual double p() const GCC11_FINAL
magnitude of momentum vector
float esClusterEnergy(unsigned i) const
float sigmaIetaIeta() const
float subClusterE3x3(unsigned i) const
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:272
Definition: DDAxes.h:10
double regressionValueWithTrkVarV2(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, double detaIn, double dphiIn, double detaCalo, double dphiCalo, double GsfTrackChiSqr, double KFTrackNLayers, double ElectronEnergyOverPout, bool printDebug=false)
float fbrem() const
Definition: GsfElectron.h:652
float eSubClusters() const
float e2x5Right() const
double regressionValueWithSubClusters(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
bool isEEDeeGap() const
Definition: GsfElectron.h:341
float eBottom() const
bool isEB() const
Definition: GsfElectron.h:333
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:185
float e2x5Bottom() const
float esClusterEta(unsigned i) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
float etaWidth() const
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
float rawEnergy() const
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float subClusterEnergy(unsigned i) const
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:237
double regressionValueNoTrkVar(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float eLeft() const
float preshowerEnergyOverRaw() const
float eRight() const
float eEleClusterOverPout() const
Definition: GsfElectron.h:232
float e2x5Top() const
float hadronicOverEm() const
float phiWidth() const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
float subClusterEmax(unsigned i) const
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
virtual int charge() const GCC11_FINAL
electric charge
Classification classification() const
Definition: GsfElectron.h:648
float seedEta() const
float correctedEcalEnergyError() const
Definition: GsfElectron.h:727
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:234
bool isEBPhiGap() const
Definition: GsfElectron.h:339
float nPreshowerClusters() const
tuple cout
Definition: gather_cfg.py:121
float seedPhi() const
float clustersSize() const
float subClusterEta(unsigned i) const
float seedEnergy() const
virtual float pt() const GCC11_FINAL
transverse momentum
float e2x5Left() const
double regressionValueWithTrkVarV1(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, bool printDebug=false)
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
bool ecalDrivenSeed() const
Definition: GsfElectron.h:172
double ElectronEnergyRegressionEvaluate::calculateRegressionEnergyUncertainty ( const reco::GsfElectron ele,
SuperClusterHelper mySCHelper,
double  rho,
double  nvertices,
bool  printDebug = false 
)

Definition at line 330 of file ElectronEnergyRegressionEvaluate.cc.

References reco::LeafCandidate::charge(), reco::GsfElectron::classification(), reco::GsfElectron::closestCtfTrackRef(), SuperClusterHelper::clustersSize(), reco::GsfElectron::correctedEcalEnergyError(), gather_cfg::cout, reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), SuperClusterHelper::e2nd(), SuperClusterHelper::e2x5Bottom(), SuperClusterHelper::e2x5Left(), SuperClusterHelper::e2x5Max(), SuperClusterHelper::e2x5Right(), SuperClusterHelper::e2x5Top(), SuperClusterHelper::e3x3(), SuperClusterHelper::e5x5(), SuperClusterHelper::eBottom(), reco::GsfElectron::ecalDrivenSeed(), reco::GsfElectron::eEleClusterOverPout(), SuperClusterHelper::eESClusters(), SuperClusterHelper::eLeft(), SuperClusterHelper::eMax(), SuperClusterHelper::eRight(), SuperClusterHelper::esClusterEnergy(), SuperClusterHelper::esClusterEta(), SuperClusterHelper::esClusterPhi(), SuperClusterHelper::eSubClusters(), reco::GsfElectron::eSuperClusterOverP(), SuperClusterHelper::eta(), reco::LeafCandidate::eta(), SuperClusterHelper::etaCrySeed(), SuperClusterHelper::etaWidth(), SuperClusterHelper::eTop(), reco::GsfElectron::fbrem(), fIsInitialized, fVersionType, reco::GsfElectron::gsfTrack(), SuperClusterHelper::hadronicOverEm(), SuperClusterHelper::ietaSeed(), SuperClusterHelper::iphiSeed(), reco::GsfElectron::isEB(), reco::GsfElectron::isEBEtaGap(), reco::GsfElectron::isEBPhiGap(), reco::GsfElectron::isEEDeeGap(), edm::Ref< C, T, F >::isNonnull(), kNoTrkVar, kNoTrkVarV1, kWithSubCluVar, kWithTrkVarV1, kWithTrkVarV2, SuperClusterHelper::nPreshowerClusters(), reco::LeafCandidate::p(), SuperClusterHelper::phi(), reco::LeafCandidate::phi(), SuperClusterHelper::phiCrySeed(), SuperClusterHelper::phiWidth(), SuperClusterHelper::preshowerEnergyOverRaw(), SQLiteCheck_cfg::printDebug, reco::LeafCandidate::pt(), SuperClusterHelper::r9(), SuperClusterHelper::rawEnergy(), regressionUncertaintyNoTrkVar(), regressionUncertaintyNoTrkVarV1(), regressionUncertaintyWithSubClusters(), regressionUncertaintyWithTrkVarV1(), regressionUncertaintyWithTrkVarV2(), rho, SuperClusterHelper::seedEnergy(), SuperClusterHelper::seedEta(), SuperClusterHelper::seedPhi(), SuperClusterHelper::sep(), SuperClusterHelper::sigmaIetaIeta(), SuperClusterHelper::spp(), SuperClusterHelper::subClusterE3x3(), SuperClusterHelper::subClusterEmax(), SuperClusterHelper::subClusterEnergy(), SuperClusterHelper::subClusterEta(), SuperClusterHelper::subClusterPhi(), reco::GsfElectron::trackMomentumAtVtx(), and reco::GsfElectron::trackMomentumError().

333  {
334 
335  if (!fIsInitialized) {
336  std::cout << "Error: Electron Energy Regression has not been initialized yet. return 0. \n";
337  return 0;
338  }
339 
340 
341  if (printDebug) {
342  std::cout << "Regression Type: " << fVersionType << std::endl;
343  std::cout << "Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n";
344  }
345 
346  if (fVersionType == kNoTrkVar) {
348  mySCHelper.rawEnergy(),
349  mySCHelper.eta(),
350  mySCHelper.phi(),
351  mySCHelper.r9(),
352  mySCHelper.etaWidth(),
353  mySCHelper.phiWidth(),
354  mySCHelper.clustersSize(),
355  mySCHelper.hadronicOverEm(),
356  rho,
357  nvertices,
358  mySCHelper.seedEta(),
359  mySCHelper.seedPhi(),
360  mySCHelper.seedEnergy(),
361  mySCHelper.e3x3(),
362  mySCHelper.e5x5(),
363  mySCHelper.sigmaIetaIeta(),
364  mySCHelper.spp(),
365  mySCHelper.sep(),
366  mySCHelper.eMax(),
367  mySCHelper.e2nd(),
368  mySCHelper.eTop(),
369  mySCHelper.eBottom(),
370  mySCHelper.eLeft(),
371  mySCHelper.eRight(),
372  mySCHelper.e2x5Max(),
373  mySCHelper.e2x5Top(),
374  mySCHelper.e2x5Bottom(),
375  mySCHelper.e2x5Left(),
376  mySCHelper.e2x5Right(),
377  mySCHelper.ietaSeed(),
378  mySCHelper.iphiSeed(),
379  mySCHelper.etaCrySeed(),
380  mySCHelper.phiCrySeed(),
381  mySCHelper.preshowerEnergyOverRaw(),
382  printDebug
383  );
384  }
385  if (fVersionType == kWithSubCluVar) {
387  mySCHelper.rawEnergy(),
388  mySCHelper.eta(),
389  mySCHelper.phi(),
390  mySCHelper.r9(),
391  mySCHelper.etaWidth(),
392  mySCHelper.phiWidth(),
393  mySCHelper.clustersSize(),
394  mySCHelper.hadronicOverEm(),
395  rho,
396  nvertices,
397  mySCHelper.seedEta(),
398  mySCHelper.seedPhi(),
399  mySCHelper.seedEnergy(),
400  mySCHelper.e3x3(),
401  mySCHelper.e5x5(),
402  mySCHelper.sigmaIetaIeta(),
403  mySCHelper.spp(),
404  mySCHelper.sep(),
405  mySCHelper.eMax(),
406  mySCHelper.e2nd(),
407  mySCHelper.eTop(),
408  mySCHelper.eBottom(),
409  mySCHelper.eLeft(),
410  mySCHelper.eRight(),
411  mySCHelper.e2x5Max(),
412  mySCHelper.e2x5Top(),
413  mySCHelper.e2x5Bottom(),
414  mySCHelper.e2x5Left(),
415  mySCHelper.e2x5Right(),
416  mySCHelper.ietaSeed(),
417  mySCHelper.iphiSeed(),
418  mySCHelper.etaCrySeed(),
419  mySCHelper.phiCrySeed(),
420  mySCHelper.preshowerEnergyOverRaw(),
421  ele->ecalDrivenSeed(),
422  ele->isEBEtaGap(),
423  ele->isEBPhiGap(),
424  ele->isEEDeeGap(),
425  mySCHelper.eSubClusters(),
426  mySCHelper.subClusterEnergy(1),
427  mySCHelper.subClusterEta(1),
428  mySCHelper.subClusterPhi(1),
429  mySCHelper.subClusterEmax(1),
430  mySCHelper.subClusterE3x3(1),
431  mySCHelper.subClusterEnergy(2),
432  mySCHelper.subClusterEta(2),
433  mySCHelper.subClusterPhi(2),
434  mySCHelper.subClusterEmax(2),
435  mySCHelper.subClusterE3x3(2),
436  mySCHelper.subClusterEnergy(3),
437  mySCHelper.subClusterEta(3),
438  mySCHelper.subClusterPhi(3),
439  mySCHelper.subClusterEmax(3),
440  mySCHelper.subClusterE3x3(3),
441  mySCHelper.nPreshowerClusters(),
442  mySCHelper.eESClusters(),
443  mySCHelper.esClusterEnergy(0),
444  mySCHelper.esClusterEta(0),
445  mySCHelper.esClusterPhi(0),
446  mySCHelper.esClusterEnergy(1),
447  mySCHelper.esClusterEta(1),
448  mySCHelper.esClusterPhi(1),
449  mySCHelper.esClusterEnergy(2),
450  mySCHelper.esClusterEta(2),
451  mySCHelper.esClusterPhi(2),
452  ele->isEB(),
453  printDebug
454  );
455  }
456  else if (fVersionType == kNoTrkVarV1) {
458  mySCHelper.rawEnergy(),
459  mySCHelper.eta(),
460  mySCHelper.phi(),
461  mySCHelper.r9(),
462  mySCHelper.etaWidth(),
463  mySCHelper.phiWidth(),
464  mySCHelper.clustersSize(),
465  mySCHelper.hadronicOverEm(),
466  rho,
467  nvertices,
468  mySCHelper.seedEta(),
469  mySCHelper.seedPhi(),
470  mySCHelper.seedEnergy(),
471  mySCHelper.e3x3(),
472  mySCHelper.e5x5(),
473  mySCHelper.sigmaIetaIeta(),
474  mySCHelper.spp(),
475  mySCHelper.sep(),
476  mySCHelper.eMax(),
477  mySCHelper.e2nd(),
478  mySCHelper.eTop(),
479  mySCHelper.eBottom(),
480  mySCHelper.eLeft(),
481  mySCHelper.eRight(),
482  mySCHelper.e2x5Max(),
483  mySCHelper.e2x5Top(),
484  mySCHelper.e2x5Bottom(),
485  mySCHelper.e2x5Left(),
486  mySCHelper.e2x5Right(),
487  mySCHelper.ietaSeed(),
488  mySCHelper.iphiSeed(),
489  mySCHelper.etaCrySeed(),
490  mySCHelper.phiCrySeed(),
491  mySCHelper.preshowerEnergyOverRaw(),
492  ele->ecalDrivenSeed(),
493  printDebug
494  );
495  }
496  else if (fVersionType == kWithTrkVarV1) {
498  mySCHelper.rawEnergy(),
499  mySCHelper.eta(),
500  mySCHelper.phi(),
501  mySCHelper.r9(),
502  mySCHelper.etaWidth(),
503  mySCHelper.phiWidth(),
504  mySCHelper.clustersSize(),
505  mySCHelper.hadronicOverEm(),
506  rho,
507  nvertices,
508  mySCHelper.seedEta(),
509  mySCHelper.seedPhi(),
510  mySCHelper.seedEnergy(),
511  mySCHelper.e3x3(),
512  mySCHelper.e5x5(),
513  mySCHelper.sigmaIetaIeta(),
514  mySCHelper.spp(),
515  mySCHelper.sep(),
516  mySCHelper.eMax(),
517  mySCHelper.e2nd(),
518  mySCHelper.eTop(),
519  mySCHelper.eBottom(),
520  mySCHelper.eLeft(),
521  mySCHelper.eRight(),
522  mySCHelper.e2x5Max(),
523  mySCHelper.e2x5Top(),
524  mySCHelper.e2x5Bottom(),
525  mySCHelper.e2x5Left(),
526  mySCHelper.e2x5Right(),
527  mySCHelper.ietaSeed(),
528  mySCHelper.iphiSeed(),
529  mySCHelper.etaCrySeed(),
530  mySCHelper.phiCrySeed(),
531  mySCHelper.preshowerEnergyOverRaw(),
532  ele->ecalDrivenSeed(),
533  ele->trackMomentumAtVtx().R(),
534  fmax(ele->fbrem(),-1.0),
535  ele->charge(),
536  fmin(ele->eSuperClusterOverP(), 20.0),
537  ele->trackMomentumError(),
539  ele->classification(),
540  printDebug
541  );
542  }
543  else if (fVersionType == kWithTrkVarV2) {
545  mySCHelper.rawEnergy(),
546  mySCHelper.eta(),
547  mySCHelper.phi(),
548  mySCHelper.r9(),
549  mySCHelper.etaWidth(),
550  mySCHelper.phiWidth(),
551  mySCHelper.clustersSize(),
552  mySCHelper.hadronicOverEm(),
553  rho,
554  nvertices,
555  mySCHelper.seedEta(),
556  mySCHelper.seedPhi(),
557  mySCHelper.seedEnergy(),
558  mySCHelper.e3x3(),
559  mySCHelper.e5x5(),
560  mySCHelper.sigmaIetaIeta(),
561  mySCHelper.spp(),
562  mySCHelper.sep(),
563  mySCHelper.eMax(),
564  mySCHelper.e2nd(),
565  mySCHelper.eTop(),
566  mySCHelper.eBottom(),
567  mySCHelper.eLeft(),
568  mySCHelper.eRight(),
569  mySCHelper.e2x5Max(),
570  mySCHelper.e2x5Top(),
571  mySCHelper.e2x5Bottom(),
572  mySCHelper.e2x5Left(),
573  mySCHelper.e2x5Right(),
574  mySCHelper.ietaSeed(),
575  mySCHelper.iphiSeed(),
576  mySCHelper.etaCrySeed(),
577  mySCHelper.phiCrySeed(),
578  mySCHelper.preshowerEnergyOverRaw(),
579  ele->ecalDrivenSeed(),
580  ele->trackMomentumAtVtx().R(),
581  fmax(ele->fbrem(),-1.0),
582  ele->charge(),
583  fmin(ele->eSuperClusterOverP(), 20.0),
584  ele->trackMomentumError(),
586  ele->classification(),
587  fmin(fabs(ele->deltaEtaSuperClusterTrackAtVtx()), 0.6),
591  ele->gsfTrack()->chi2() / ele->gsfTrack()->ndof(),
592  (ele->closestCtfTrackRef().isNonnull() ? ele->closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement() : -1),
593  fmin(ele->eEleClusterOverPout(),20.0),
594  printDebug
595  );
596  }
597  else {
598  std::cout << "Warning: Electron Regression Type " << fVersionType << " is not supported. Reverting to default electron momentum.\n";
599  return ele->p();
600  }
601 }
float trackMomentumError() const
Definition: GsfElectron.h:728
float eESClusters() const
float e2x5Max() const
bool isEBEtaGap() const
Definition: GsfElectron.h:338
float eSuperClusterOverP() const
Definition: GsfElectron.h:229
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
virtual double p() const GCC11_FINAL
magnitude of momentum vector
float esClusterEnergy(unsigned i) const
float sigmaIetaIeta() const
float subClusterE3x3(unsigned i) const
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:272
Definition: DDAxes.h:10
float fbrem() const
Definition: GsfElectron.h:652
float eSubClusters() const
double regressionUncertaintyNoTrkVar(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, bool printDebug=false)
float e2x5Right() const
bool isEEDeeGap() const
Definition: GsfElectron.h:341
float eBottom() const
bool isEB() const
Definition: GsfElectron.h:333
TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:185
float e2x5Bottom() const
double regressionUncertaintyNoTrkVarV1(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, bool printDebug=false)
double regressionUncertaintyWithTrkVarV1(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, bool printDebug=false)
float esClusterEta(unsigned i) const
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
float etaWidth() const
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
float rawEnergy() const
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:233
float subClusterEnergy(unsigned i) const
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:237
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:236
float eLeft() const
float preshowerEnergyOverRaw() const
float eRight() const
float eEleClusterOverPout() const
Definition: GsfElectron.h:232
float e2x5Top() const
float hadronicOverEm() const
float phiWidth() const
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
float subClusterEmax(unsigned i) const
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
virtual int charge() const GCC11_FINAL
electric charge
Classification classification() const
Definition: GsfElectron.h:648
float seedEta() const
float correctedEcalEnergyError() const
Definition: GsfElectron.h:727
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:234
bool isEBPhiGap() const
Definition: GsfElectron.h:339
float nPreshowerClusters() const
tuple cout
Definition: gather_cfg.py:121
float seedPhi() const
float clustersSize() const
float subClusterEta(unsigned i) const
float seedEnergy() const
virtual float pt() const GCC11_FINAL
transverse momentum
double regressionUncertaintyWithSubClusters(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, double isEcalDriven, double isEtaGap, double isPhiGap, double isDeeGap, double ESubs, double ESub1, double EtaSub1, double PhiSub1, double EMaxSub1, double E3x3Sub1, double ESub2, double EtaSub2, double PhiSub2, double EMaxSub2, double E3x3Sub2, double ESub3, double EtaSub3, double PhiSub3, double EMaxSub3, double E3x3Sub3, double NPshwClusters, double EPshwSubs, double EPshwSub1, double EtaPshwSub1, double PhiPshwSub1, double EPshwSub2, double EtaPshwSub2, double PhiPshwSub2, double EPshwSub3, double EtaPshwSub3, double PhiPshwSub3, bool isEB, bool printDebug=false)
float e2x5Left() const
double regressionUncertaintyWithTrkVarV2(double SCRawEnergy, double scEta, double scPhi, double R9, double etawidth, double phiwidth, double NClusters, double HoE, double rho, double vertices, double EtaSeed, double PhiSeed, double ESeed, double E3x3Seed, double E5x5Seed, double see, double spp, double sep, double EMaxSeed, double E2ndSeed, double ETopSeed, double EBottomSeed, double ELeftSeed, double ERightSeed, double E2x5MaxSeed, double E2x5TopSeed, double E2x5BottomSeed, double E2x5LeftSeed, double E2x5RightSeed, double IEtaSeed, double IPhiSeed, double EtaCrySeed, double PhiCrySeed, double PreShowerOverRaw, int IsEcalDriven, double GsfTrackPIn, double fbrem, double Charge, double EoP, double TrackMomentumError, double EcalEnergyError, int Classification, double detaIn, double dphiIn, double detaCalo, double dphiCalo, double GsfTrackChiSqr, double KFTrackNLayers, double ElectronEnergyOverPout, bool printDebug=false)
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169
bool ecalDrivenSeed() const
Definition: GsfElectron.h:172
void ElectronEnergyRegressionEvaluate::initialize ( std::string  weightsFile,
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType  type 
)

Definition at line 29 of file ElectronEnergyRegressionEvaluate.cc.

References mergeVDriftHistosByStation::file, fIsInitialized, forestCorrection_eb, forestCorrection_ee, forestUncertainty_eb, forestUncertainty_ee, and fVersionType.

30  {
31 
32  // Loading forest object according to different versions
33  TFile file(edm::FileInPath(weightsFile.c_str()).fullPath().c_str());
34 
35  forestCorrection_eb = (GBRForest*) file.Get("EBCorrection");
36  forestCorrection_ee = (GBRForest*) file.Get("EECorrection");
37  forestUncertainty_eb = (GBRForest*) file.Get("EBUncertainty");
38  forestUncertainty_ee = (GBRForest*) file.Get("EEUncertainty");
39 
40  // Just checking
41  assert(forestCorrection_eb);
42  assert(forestCorrection_ee);
43  assert(forestUncertainty_eb);
44  assert(forestUncertainty_ee);
45 
46  // Updating type and marking as initialized
48  fIsInitialized = kTRUE;
49 
50 }
type
Definition: HCALResponse.h:21
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
bool ElectronEnergyRegressionEvaluate::isInitialized ( ) const
inline
double ElectronEnergyRegressionEvaluate::regressionUncertaintyNoTrkVar ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
bool  printDebug = false 
)

Definition at line 769 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kNoTrkVar, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergyUncertainty().

805 {
806  // Checking if instance has been initialized
807  if (fIsInitialized == kFALSE) {
808  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
809  return 0;
810  }
811 
812  // Checking if type is correct
813  if (!(fVersionType == kNoTrkVar)) {
814  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueNoTrkVar.\n";
815  return 0;
816  }
817 
818  // Now applying regression according to version and (endcap/barrel)
819  float *vals = (fabs(scEta) <= 1.479) ? new float[38] : new float[31];
820  if (fabs(scEta) <= 1.479) { // Barrel
821  vals[0] = SCRawEnergy;
822  vals[1] = scEta;
823  vals[2] = scPhi;
824  vals[3] = R9;
825  vals[4] = E5x5Seed/SCRawEnergy;
826  vals[5] = etawidth;
827  vals[6] = phiwidth;
828  vals[7] = NClusters;
829  vals[8] = HoE;
830  vals[9] = rho;
831  vals[10] = vertices;
832  vals[11] = EtaSeed - scEta;
833  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
834  vals[13] = ESeed/SCRawEnergy;
835  vals[14] = E3x3Seed/ESeed;
836  vals[15] = E5x5Seed/ESeed;
837  vals[16] = see;
838  vals[17] = spp;
839  vals[18] = sep;
840  vals[19] = EMaxSeed/ESeed;
841  vals[20] = E2ndSeed/ESeed;
842  vals[21] = ETopSeed/ESeed;
843  vals[22] = EBottomSeed/ESeed;
844  vals[23] = ELeftSeed/ESeed;
845  vals[24] = ERightSeed/ESeed;
846  vals[25] = E2x5MaxSeed/ESeed;
847  vals[26] = E2x5TopSeed/ESeed;
848  vals[27] = E2x5BottomSeed/ESeed;
849  vals[28] = E2x5LeftSeed/ESeed;
850  vals[29] = E2x5RightSeed/ESeed;
851  vals[30] = IEtaSeed;
852  vals[31] = IPhiSeed;
853  vals[32] = ((int) IEtaSeed)%5;
854  vals[33] = ((int) IPhiSeed)%2;
855  vals[34] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
856  vals[35] = ((int) IPhiSeed)%20;
857  vals[36] = EtaCrySeed;
858  vals[37] = PhiCrySeed;
859  }
860  else { // Endcap
861  vals[0] = SCRawEnergy;
862  vals[1] = scEta;
863  vals[2] = scPhi;
864  vals[3] = R9;
865  vals[4] = E5x5Seed/SCRawEnergy;
866  vals[5] = etawidth;
867  vals[6] = phiwidth;
868  vals[7] = NClusters;
869  vals[8] = HoE;
870  vals[9] = rho;
871  vals[10] = vertices;
872  vals[11] = EtaSeed - scEta;
873  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
874  vals[13] = ESeed/SCRawEnergy;
875  vals[14] = E3x3Seed/ESeed;
876  vals[15] = E5x5Seed/ESeed;
877  vals[16] = see;
878  vals[17] = spp;
879  vals[18] = sep;
880  vals[19] = EMaxSeed/ESeed;
881  vals[20] = E2ndSeed/ESeed;
882  vals[21] = ETopSeed/ESeed;
883  vals[22] = EBottomSeed/ESeed;
884  vals[23] = ELeftSeed/ESeed;
885  vals[24] = ERightSeed/ESeed;
886  vals[25] = E2x5MaxSeed/ESeed;
887  vals[26] = E2x5TopSeed/ESeed;
888  vals[27] = E2x5BottomSeed/ESeed;
889  vals[28] = E2x5LeftSeed/ESeed;
890  vals[29] = E2x5RightSeed/ESeed;
891  vals[30] = PreShowerOverRaw;
892  }
893 
894  // Now evaluating the regression
895  double regressionResult = 0;
896  Int_t BinIndex = -1;
897 
898  if (fVersionType == kNoTrkVar) {
899  if (fabs(scEta) <= 1.479) {
900  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
901  BinIndex = 0;
902  }
903  else {
904  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
905  BinIndex = 1;
906  }
907  }
908 
909  //print debug
910  if (printDebug) {
911  if (fabs(scEta) <= 1.479) {
912  std::cout << "Barrel :";
913  for (unsigned int v=0; v < 38; ++v) std::cout << vals[v] << ", ";
914  std::cout << "\n";
915  }
916  else {
917  std::cout << "Endcap :";
918  for (unsigned int v=0; v < 31; ++v) std::cout << vals[v] << ", ";
919  std::cout << "\n";
920  }
921  std::cout << "BinIndex : " << BinIndex << "\n";
922  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
923  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
924  }
925 
926 
927  // Cleaning up and returning
928  delete[] vals;
929  return regressionResult;
930 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyNoTrkVarV1 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
bool  printDebug = false 
)

Definition at line 1101 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kNoTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergyUncertainty().

1138 {
1139  // Checking if instance has been initialized
1140  if (fIsInitialized == kFALSE) {
1141  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1142  return 0;
1143  }
1144 
1145  // Checking if type is correct
1146  if (!(fVersionType == kNoTrkVarV1)) {
1147  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueNoTrkVar.\n";
1148  return 0;
1149  }
1150 
1151  // Now applying regression according to version and (endcap/barrel)
1152  float *vals = (fabs(scEta) <= 1.479) ? new float[39] : new float[32];
1153  if (fabs(scEta) <= 1.479) { // Barrel
1154  vals[0] = SCRawEnergy;
1155  vals[1] = scEta;
1156  vals[2] = scPhi;
1157  vals[3] = R9;
1158  vals[4] = E5x5Seed/SCRawEnergy;
1159  vals[5] = etawidth;
1160  vals[6] = phiwidth;
1161  vals[7] = NClusters;
1162  vals[8] = HoE;
1163  vals[9] = rho;
1164  vals[10] = vertices;
1165  vals[11] = EtaSeed - scEta;
1166  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1167  vals[13] = ESeed/SCRawEnergy;
1168  vals[14] = E3x3Seed/ESeed;
1169  vals[15] = E5x5Seed/ESeed;
1170  vals[16] = see;
1171  vals[17] = spp;
1172  vals[18] = sep;
1173  vals[19] = EMaxSeed/ESeed;
1174  vals[20] = E2ndSeed/ESeed;
1175  vals[21] = ETopSeed/ESeed;
1176  vals[22] = EBottomSeed/ESeed;
1177  vals[23] = ELeftSeed/ESeed;
1178  vals[24] = ERightSeed/ESeed;
1179  vals[25] = E2x5MaxSeed/ESeed;
1180  vals[26] = E2x5TopSeed/ESeed;
1181  vals[27] = E2x5BottomSeed/ESeed;
1182  vals[28] = E2x5LeftSeed/ESeed;
1183  vals[29] = E2x5RightSeed/ESeed;
1184  vals[30] = IsEcalDriven;
1185  vals[31] = IEtaSeed;
1186  vals[32] = IPhiSeed;
1187  vals[33] = ((int) IEtaSeed)%5;
1188  vals[34] = ((int) IPhiSeed)%2;
1189  vals[35] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1190  vals[36] = ((int) IPhiSeed)%20;
1191  vals[37] = EtaCrySeed;
1192  vals[38] = PhiCrySeed;
1193  }
1194  else { // Endcap
1195  vals[0] = SCRawEnergy;
1196  vals[1] = scEta;
1197  vals[2] = scPhi;
1198  vals[3] = R9;
1199  vals[4] = E5x5Seed/SCRawEnergy;
1200  vals[5] = etawidth;
1201  vals[6] = phiwidth;
1202  vals[7] = NClusters;
1203  vals[8] = HoE;
1204  vals[9] = rho;
1205  vals[10] = vertices;
1206  vals[11] = EtaSeed - scEta;
1207  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1208  vals[13] = ESeed/SCRawEnergy;
1209  vals[14] = E3x3Seed/ESeed;
1210  vals[15] = E5x5Seed/ESeed;
1211  vals[16] = see;
1212  vals[17] = spp;
1213  vals[18] = sep;
1214  vals[19] = EMaxSeed/ESeed;
1215  vals[20] = E2ndSeed/ESeed;
1216  vals[21] = ETopSeed/ESeed;
1217  vals[22] = EBottomSeed/ESeed;
1218  vals[23] = ELeftSeed/ESeed;
1219  vals[24] = ERightSeed/ESeed;
1220  vals[25] = E2x5MaxSeed/ESeed;
1221  vals[26] = E2x5TopSeed/ESeed;
1222  vals[27] = E2x5BottomSeed/ESeed;
1223  vals[28] = E2x5LeftSeed/ESeed;
1224  vals[29] = E2x5RightSeed/ESeed;
1225  vals[30] = IsEcalDriven;
1226  vals[31] = PreShowerOverRaw;
1227  }
1228 
1229  // Now evaluating the regression
1230  double regressionResult = 0;
1231  Int_t BinIndex = -1;
1232 
1233  if (fVersionType == kNoTrkVarV1) {
1234  if (fabs(scEta) <= 1.479) {
1235  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1236  BinIndex = 0;
1237  }
1238  else {
1239  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1240  BinIndex = 1;
1241  }
1242  }
1243 
1244  //print debug
1245  if (printDebug) {
1246  if (fabs(scEta) <= 1.479) {
1247  std::cout << "Barrel :";
1248  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
1249  std::cout << "\n";
1250  }
1251  else {
1252  std::cout << "Endcap :";
1253  for (unsigned int v=0; v < 32; ++v) std::cout << vals[v] << ", ";
1254  std::cout << "\n";
1255  }
1256  std::cout << "BinIndex : " << BinIndex << "\n";
1257  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1258  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1259  }
1260 
1261 
1262  // Cleaning up and returning
1263  delete[] vals;
1264  return regressionResult;
1265 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithSubClusters ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
double  isEcalDriven,
double  isEtaGap,
double  isPhiGap,
double  isDeeGap,
double  ESubs,
double  ESub1,
double  EtaSub1,
double  PhiSub1,
double  EMaxSub1,
double  E3x3Sub1,
double  ESub2,
double  EtaSub2,
double  PhiSub2,
double  EMaxSub2,
double  E3x3Sub2,
double  ESub3,
double  EtaSub3,
double  PhiSub3,
double  EMaxSub3,
double  E3x3Sub3,
double  NPshwClusters,
double  EPshwSubs,
double  EPshwSub1,
double  EtaPshwSub1,
double  PhiPshwSub1,
double  EPshwSub2,
double  EtaPshwSub2,
double  PhiPshwSub2,
double  EPshwSub3,
double  EtaPshwSub3,
double  PhiPshwSub3,
bool  isEB,
bool  printDebug = false 
)

Definition at line 3401 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithSubCluVar, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergyUncertainty().

3469 {
3470  // Checking if instance has been initialized
3471  if (fIsInitialized == kFALSE) {
3472  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
3473  return 0;
3474  }
3475 
3476  // Checking if type is correct
3477  if (!(fVersionType == kWithSubCluVar)) {
3478  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueWithSubClusters.\n";
3479  return 0;
3480  }
3481 
3482  // Now applying regression according to version and (endcap/barrel)
3483  float *vals = (isEB) ? new float[61] : new float[65];
3484  if (isEB) { // Barrel
3485  vals[0] = rho;
3486  vals[1] = vertices;
3487  vals[2] = isEcalDriven;
3488  vals[3] = isEtaGap;
3489  vals[4] = isPhiGap;
3490  vals[5] = isDeeGap;
3491  vals[6] = SCRawEnergy;
3492  vals[7] = scEta;
3493  vals[8] = scPhi;
3494  vals[9] = R9;
3495  vals[10] = etawidth;
3496  vals[11] = phiwidth;
3497  vals[12] = NClusters;
3498  vals[13] = HoE;
3499  vals[14] = EtaSeed - scEta;
3500  vals[15] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3501  vals[16] = ESeed/SCRawEnergy;
3502  vals[17] = E3x3Seed/ESeed;
3503  vals[18] = E5x5Seed/SCRawEnergy;
3504  vals[19] = E5x5Seed/ESeed;
3505  vals[20] = EMaxSeed/ESeed;
3506  vals[21] = E2ndSeed/ESeed;
3507  vals[22] = ETopSeed/ESeed;
3508  vals[23] = EBottomSeed/ESeed;
3509  vals[24] = ELeftSeed/ESeed;
3510  vals[25] = ERightSeed/ESeed;
3511  vals[26] = E2x5MaxSeed/ESeed;
3512  vals[27] = E2x5TopSeed/ESeed;
3513  vals[28] = E2x5BottomSeed/ESeed;
3514  vals[29] = E2x5LeftSeed/ESeed;
3515  vals[30] = E2x5RightSeed/ESeed;
3516  vals[31] = see;
3517  vals[32] = spp;
3518  vals[33] = sep;
3519  vals[34] = phiwidth/etawidth;
3520  vals[35] = (ELeftSeed+ERightSeed==0. ? 0. : (ELeftSeed-ERightSeed)/(ELeftSeed+ERightSeed));
3521  vals[36] = (ETopSeed+EBottomSeed==0. ? 0. : (ETopSeed-EBottomSeed)/(ETopSeed+EBottomSeed));
3522  vals[37] = ESubs/SCRawEnergy;
3523  vals[38] = ESub1/SCRawEnergy;
3524  vals[39] = (NClusters<=1 ? 999. : EtaSub1-EtaSeed);
3525  vals[40] = (NClusters<=1 ? 999. : atan2(sin(PhiSub1-PhiSeed),cos(PhiSub1-PhiSeed)));
3526  vals[41] = (NClusters<=1 ? 0. : EMaxSub1/ESub1);
3527  vals[42] = (NClusters<=1 ? 0. : E3x3Sub1/ESub1);
3528  vals[43] = ESub2/SCRawEnergy;
3529  vals[44] = (NClusters<=2 ? 999. : EtaSub2-EtaSeed);
3530  vals[45] = (NClusters<=2 ? 999. : atan2(sin(PhiSub2-PhiSeed),cos(PhiSub2-PhiSeed)));
3531  vals[46] = (NClusters<=2 ? 0. : EMaxSub2/ESub2);
3532  vals[47] = (NClusters<=2 ? 0. : E3x3Sub2/ESub2);
3533  vals[48] = ESub3/SCRawEnergy;
3534  vals[49] = (NClusters<=3 ? 999. : EtaSub3-EtaSeed);
3535  vals[50] = (NClusters<=3 ? 999. : atan2(sin(PhiSub3-PhiSeed),cos(PhiSub3-PhiSeed)));
3536  vals[51] = (NClusters<=3 ? 0. : EMaxSub3/ESub3);
3537  vals[52] = (NClusters<=3 ? 0. : E3x3Sub3/ESub3);
3538  vals[53] = IEtaSeed;
3539  vals[54] = ((int) IEtaSeed)%5;
3540  vals[55] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
3541  vals[56] = IPhiSeed;
3542  vals[57] = ((int) IPhiSeed)%2;
3543  vals[58] = ((int) IPhiSeed)%20;
3544  vals[59] = EtaCrySeed;
3545  vals[60] = PhiCrySeed;
3546  }
3547  else { // Endcap
3548  vals[0] = rho;
3549  vals[1] = vertices;
3550  vals[2] = isEcalDriven;
3551  vals[3] = isEtaGap;
3552  vals[4] = isPhiGap;
3553  vals[5] = isDeeGap;
3554  vals[6] = SCRawEnergy;
3555  vals[7] = scEta;
3556  vals[8] = scPhi;
3557  vals[9] = R9;
3558  vals[10] = etawidth;
3559  vals[11] = phiwidth;
3560  vals[12] = NClusters;
3561  vals[13] = HoE;
3562  vals[14] = EtaSeed - scEta;
3563  vals[15] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3564  vals[16] = ESeed/SCRawEnergy;
3565  vals[17] = E3x3Seed/ESeed;
3566  vals[18] = E5x5Seed/SCRawEnergy;
3567  vals[19] = E5x5Seed/ESeed;
3568  vals[20] = EMaxSeed/ESeed;
3569  vals[21] = E2ndSeed/ESeed;
3570  vals[22] = ETopSeed/ESeed;
3571  vals[23] = EBottomSeed/ESeed;
3572  vals[24] = ELeftSeed/ESeed;
3573  vals[25] = ERightSeed/ESeed;
3574  vals[26] = E2x5MaxSeed/ESeed;
3575  vals[27] = E2x5TopSeed/ESeed;
3576  vals[28] = E2x5BottomSeed/ESeed;
3577  vals[29] = E2x5LeftSeed/ESeed;
3578  vals[30] = E2x5RightSeed/ESeed;
3579  vals[31] = see;
3580  vals[32] = spp;
3581  vals[33] = sep;
3582  vals[34] = phiwidth/etawidth;
3583  vals[35] = (ELeftSeed+ERightSeed==0. ? 0. : (ELeftSeed-ERightSeed)/(ELeftSeed+ERightSeed));
3584  vals[36] = (ETopSeed+EBottomSeed==0. ? 0. : (ETopSeed-EBottomSeed)/(ETopSeed+EBottomSeed));
3585  vals[37] = ESubs/SCRawEnergy;
3586  vals[38] = ESub1/SCRawEnergy;
3587  vals[39] = (NClusters<=1 ? 999. : EtaSub1-EtaSeed);
3588  vals[40] = (NClusters<=1 ? 999. : atan2(sin(PhiSub1-PhiSeed),cos(PhiSub1-PhiSeed)));
3589  vals[41] = (NClusters<=1 ? 0. : EMaxSub1/ESub1);
3590  vals[42] = (NClusters<=1 ? 0. : E3x3Sub1/ESub1);
3591  vals[43] = ESub2/SCRawEnergy;
3592  vals[44] = (NClusters<=2 ? 999. : EtaSub2-EtaSeed);
3593  vals[45] = (NClusters<=2 ? 999. : atan2(sin(PhiSub2-PhiSeed),cos(PhiSub2-PhiSeed)));
3594  vals[46] = (NClusters<=2 ? 0. : EMaxSub2/ESub2);
3595  vals[47] = (NClusters<=2 ? 0. : E3x3Sub2/ESub2);
3596  vals[48] = ESub3/SCRawEnergy;
3597  vals[49] = (NClusters<=3 ? 999. : EtaSub3-EtaSeed);
3598  vals[50] = (NClusters<=3 ? 999. : atan2(sin(PhiSub3-PhiSeed),cos(PhiSub3-PhiSeed)));
3599  vals[51] = (NClusters<=3 ? 0. : EMaxSub3/ESub3);
3600  vals[52] = (NClusters<=3 ? 0. : E3x3Sub3/ESub3);
3601  vals[53] = PreShowerOverRaw;
3602  vals[54] = NPshwClusters;
3603  vals[55] = EPshwSubs/SCRawEnergy;
3604  vals[56] = EPshwSub1/SCRawEnergy;
3605  vals[57] = (NPshwClusters<=0 ? 999. : EtaPshwSub1-EtaSeed);
3606  vals[58] = (NPshwClusters<=0 ? 999. : atan2(sin(PhiPshwSub1-PhiSeed),cos(PhiPshwSub1-PhiSeed)));
3607  vals[59] = EPshwSub2/SCRawEnergy;
3608  vals[60] = (NPshwClusters<=1 ? 999. : EtaPshwSub2-EtaSeed);
3609  vals[61] = (NPshwClusters<=1 ? 999. : atan2(sin(PhiPshwSub2-PhiSeed),cos(PhiPshwSub2-PhiSeed)));
3610  vals[62] = EPshwSub3/SCRawEnergy;
3611  vals[63] = (NPshwClusters<=2 ? 999. : EtaPshwSub3-EtaSeed);
3612  vals[64] = (NPshwClusters<=2 ? 999. : atan2(sin(PhiPshwSub3-PhiSeed),cos(PhiPshwSub3-PhiSeed)));
3613 
3614  }
3615 
3616  // Now evaluating the regression
3617  double regressionResult = 0;
3618  Int_t BinIndex = -1;
3619 
3620  if (fVersionType == kWithSubCluVar) {
3621  if (isEB) {
3622  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
3623  BinIndex = 0;
3624  }
3625  else {
3626  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
3627  BinIndex = 1;
3628  }
3629  }
3630 
3631  //print debug
3632  if (printDebug) {
3633  if (isEB) {
3634  std::cout << "Barrel :";
3635  for (unsigned int v=0; v < 38; ++v) std::cout << vals[v] << ", ";
3636  std::cout << "\n";
3637  }
3638  else {
3639  std::cout << "Endcap :";
3640  for (unsigned int v=0; v < 31; ++v) std::cout << vals[v] << ", ";
3641  std::cout << "\n";
3642  }
3643  std::cout << "BinIndex : " << BinIndex << "\n";
3644  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3645  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
3646  }
3647 
3648 
3649  // Cleaning up and returning
3650  delete[] vals;
3651  return regressionResult;
3652 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVar ( double  electronP,
double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  pt,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
bool  printDebug = false 
)

Definition at line 1444 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVar, RecoTauCleanerPlugins::pt, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

1486 {
1487  // Checking if instance has been initialized
1488  if (fIsInitialized == kFALSE) {
1489  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1490  return 0;
1491  }
1492 
1493  // Checking if fVersionType is correct
1494  assert(fVersionType == kWithTrkVar);
1495 
1496  float *vals = (fabs(scEta) <= 1.479) ? new float[43] : new float[36];
1497  if (fabs(scEta) <= 1.479) { // Barrel
1498  vals[0] = SCRawEnergy;
1499  vals[1] = scEta;
1500  vals[2] = scPhi;
1501  vals[3] = R9;
1502  vals[4] = E5x5Seed/SCRawEnergy;
1503  vals[5] = etawidth;
1504  vals[6] = phiwidth;
1505  vals[7] = NClusters;
1506  vals[8] = HoE;
1507  vals[9] = rho;
1508  vals[10] = vertices;
1509  vals[11] = EtaSeed - scEta;
1510  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1511  vals[13] = ESeed/SCRawEnergy;
1512  vals[14] = E3x3Seed/ESeed;
1513  vals[15] = E5x5Seed/ESeed;
1514  vals[16] = see;
1515  vals[17] = spp;
1516  vals[18] = sep;
1517  vals[19] = EMaxSeed/ESeed;
1518  vals[20] = E2ndSeed/ESeed;
1519  vals[21] = ETopSeed/ESeed;
1520  vals[22] = EBottomSeed/ESeed;
1521  vals[23] = ELeftSeed/ESeed;
1522  vals[24] = ERightSeed/ESeed;
1523  vals[25] = E2x5MaxSeed/ESeed;
1524  vals[26] = E2x5TopSeed/ESeed;
1525  vals[27] = E2x5BottomSeed/ESeed;
1526  vals[28] = E2x5LeftSeed/ESeed;
1527  vals[29] = E2x5RightSeed/ESeed;
1528  vals[30] = pt;
1529  vals[31] = GsfTrackPIn;
1530  vals[32] = fbrem;
1531  vals[33] = Charge;
1532  vals[34] = EoP;
1533  vals[35] = IEtaSeed;
1534  vals[36] = IPhiSeed;
1535  vals[37] = ((int) IEtaSeed)%5;
1536  vals[38] = ((int) IPhiSeed)%2;
1537  vals[39] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1538  vals[40] = ((int) IPhiSeed)%20;
1539  vals[41] = EtaCrySeed;
1540  vals[42] = PhiCrySeed;
1541  }
1542 
1543  else { // Endcap
1544  vals[0] = SCRawEnergy;
1545  vals[1] = scEta;
1546  vals[2] = scPhi;
1547  vals[3] = R9;
1548  vals[4] = E5x5Seed/SCRawEnergy;
1549  vals[5] = etawidth;
1550  vals[6] = phiwidth;
1551  vals[7] = NClusters;
1552  vals[8] = HoE;
1553  vals[9] = rho;
1554  vals[10] = vertices;
1555  vals[11] = EtaSeed - scEta;
1556  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1557  vals[13] = ESeed/SCRawEnergy;
1558  vals[14] = E3x3Seed/ESeed;
1559  vals[15] = E5x5Seed/ESeed;
1560  vals[16] = see;
1561  vals[17] = spp;
1562  vals[18] = sep;
1563  vals[19] = EMaxSeed/ESeed;
1564  vals[20] = E2ndSeed/ESeed;
1565  vals[21] = ETopSeed/ESeed;
1566  vals[22] = EBottomSeed/ESeed;
1567  vals[23] = ELeftSeed/ESeed;
1568  vals[24] = ERightSeed/ESeed;
1569  vals[25] = E2x5MaxSeed/ESeed;
1570  vals[26] = E2x5TopSeed/ESeed;
1571  vals[27] = E2x5BottomSeed/ESeed;
1572  vals[28] = E2x5LeftSeed/ESeed;
1573  vals[29] = E2x5RightSeed/ESeed;
1574  vals[30] = pt;
1575  vals[31] = GsfTrackPIn;
1576  vals[32] = fbrem;
1577  vals[33] = Charge;
1578  vals[34] = EoP;
1579  vals[35] = PreShowerOverRaw;
1580  }
1581 
1582  // Now evaluating the regression
1583  double regressionResult = 0;
1584 
1585  if (fVersionType == kWithTrkVar) {
1586  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1587  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1588  }
1589 
1590  //print debug
1591  if (printDebug) {
1592  if (scEta <= 1.479) {
1593  std::cout << "Barrel :";
1594  for (unsigned int v=0; v < 43; ++v) std::cout << vals[v] << ", ";
1595  std::cout << "\n";
1596  }
1597  else {
1598  std::cout << "Endcap :";
1599  for (unsigned int v=0; v < 36; ++v) std::cout << vals[v] << ", ";
1600  std::cout << "\n";
1601  }
1602  std::cout << "pt = " << pt << " : SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1603  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1604  }
1605 
1606 
1607  // Cleaning up and returning
1608  delete[] vals;
1609  return regressionResult;
1610 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV1 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  TrackMomentumError,
double  EcalEnergyError,
int  Classification,
bool  printDebug = false 
)

Definition at line 1794 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergyUncertainty().

1838 {
1839  // Checking if instance has been initialized
1840  if (fIsInitialized == kFALSE) {
1841  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1842  return 0;
1843  }
1844 
1845  // Checking if fVersionType is correct
1846  assert(fVersionType == kWithTrkVarV1);
1847 
1848  float *vals = (fabs(scEta) <= 1.479) ? new float[46] : new float[39];
1849  if (fabs(scEta) <= 1.479) { // Barrel
1850  vals[0] = SCRawEnergy;
1851  vals[1] = scEta;
1852  vals[2] = scPhi;
1853  vals[3] = R9;
1854  vals[4] = E5x5Seed/SCRawEnergy;
1855  vals[5] = etawidth;
1856  vals[6] = phiwidth;
1857  vals[7] = NClusters;
1858  vals[8] = HoE;
1859  vals[9] = rho;
1860  vals[10] = vertices;
1861  vals[11] = EtaSeed - scEta;
1862  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1863  vals[13] = ESeed/SCRawEnergy;
1864  vals[14] = E3x3Seed/ESeed;
1865  vals[15] = E5x5Seed/ESeed;
1866  vals[16] = see;
1867  vals[17] = spp;
1868  vals[18] = sep;
1869  vals[19] = EMaxSeed/ESeed;
1870  vals[20] = E2ndSeed/ESeed;
1871  vals[21] = ETopSeed/ESeed;
1872  vals[22] = EBottomSeed/ESeed;
1873  vals[23] = ELeftSeed/ESeed;
1874  vals[24] = ERightSeed/ESeed;
1875  vals[25] = E2x5MaxSeed/ESeed;
1876  vals[26] = E2x5TopSeed/ESeed;
1877  vals[27] = E2x5BottomSeed/ESeed;
1878  vals[28] = E2x5LeftSeed/ESeed;
1879  vals[29] = E2x5RightSeed/ESeed;
1880  vals[30] = IsEcalDriven;
1881  vals[31] = GsfTrackPIn;
1882  vals[32] = fbrem;
1883  vals[33] = Charge;
1884  vals[34] = EoP;
1885  vals[35] = TrackMomentumError/GsfTrackPIn;
1886  vals[36] = EcalEnergyError/SCRawEnergy;
1887  vals[37] = Classification;
1888  vals[38] = IEtaSeed;
1889  vals[39] = IPhiSeed;
1890  vals[40] = ((int) IEtaSeed)%5;
1891  vals[41] = ((int) IPhiSeed)%2;
1892  vals[42] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1893  vals[43] = ((int) IPhiSeed)%20;
1894  vals[44] = EtaCrySeed;
1895  vals[45] = PhiCrySeed;
1896  }
1897 
1898  else { // Endcap
1899  vals[0] = SCRawEnergy;
1900  vals[1] = scEta;
1901  vals[2] = scPhi;
1902  vals[3] = R9;
1903  vals[4] = E5x5Seed/SCRawEnergy;
1904  vals[5] = etawidth;
1905  vals[6] = phiwidth;
1906  vals[7] = NClusters;
1907  vals[8] = HoE;
1908  vals[9] = rho;
1909  vals[10] = vertices;
1910  vals[11] = EtaSeed - scEta;
1911  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1912  vals[13] = ESeed/SCRawEnergy;
1913  vals[14] = E3x3Seed/ESeed;
1914  vals[15] = E5x5Seed/ESeed;
1915  vals[16] = see;
1916  vals[17] = spp;
1917  vals[18] = sep;
1918  vals[19] = EMaxSeed/ESeed;
1919  vals[20] = E2ndSeed/ESeed;
1920  vals[21] = ETopSeed/ESeed;
1921  vals[22] = EBottomSeed/ESeed;
1922  vals[23] = ELeftSeed/ESeed;
1923  vals[24] = ERightSeed/ESeed;
1924  vals[25] = E2x5MaxSeed/ESeed;
1925  vals[26] = E2x5TopSeed/ESeed;
1926  vals[27] = E2x5BottomSeed/ESeed;
1927  vals[28] = E2x5LeftSeed/ESeed;
1928  vals[29] = E2x5RightSeed/ESeed;
1929  vals[30] = IsEcalDriven;
1930  vals[31] = GsfTrackPIn;
1931  vals[32] = fbrem;
1932  vals[33] = Charge;
1933  vals[34] = EoP;
1934  vals[35] = TrackMomentumError/GsfTrackPIn;
1935  vals[36] = EcalEnergyError/SCRawEnergy;
1936  vals[37] = Classification;
1937  vals[38] = PreShowerOverRaw;
1938  }
1939 
1940  // Now evaluating the regression
1941  double regressionResult = 0;
1942 
1943  if (fVersionType == kWithTrkVarV1) {
1944  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1945  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1946  }
1947 
1948  //print debug
1949  if (printDebug) {
1950  if (fabs(scEta) <= 1.479) {
1951  std::cout << "Barrel :";
1952  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
1953  std::cout << "\n";
1954  }
1955  else {
1956  std::cout << "Endcap :";
1957  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
1958  std::cout << "\n";
1959  }
1960  std::cout << " SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1961  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1962  }
1963 
1964 
1965  // Cleaning up and returning
1966  delete[] vals;
1967  return regressionResult;
1968 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV1 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2157 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

2159 {
2160  // Checking if instance has been initialized
2161  if (fIsInitialized == kFALSE) {
2162  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2163  return 0;
2164  }
2165 
2166  // Checking if fVersionType is correct
2167  assert(fVersionType == kWithTrkVarV1);
2168 
2169  // Checking if fVersionType is correct
2170  assert(inputvars.size() == 42);
2171 
2172  double SCRawEnergy = inputvars[0];
2173  double scEta = inputvars[1];
2174  double scPhi = inputvars[2];
2175  double R9 = inputvars[3];
2176  double etawidth = inputvars[4];
2177  double phiwidth = inputvars[5];
2178  double NClusters = inputvars[6];
2179  double HoE = inputvars[7];
2180  double rho = inputvars[8];
2181  double vertices = inputvars[9];
2182  double EtaSeed = inputvars[10];
2183  double PhiSeed = inputvars[11];
2184  double ESeed = inputvars[12];
2185  double E3x3Seed = inputvars[13];
2186  double E5x5Seed = inputvars[14];
2187  double see = inputvars[15];
2188  double spp = inputvars[16];
2189  double sep = inputvars[17];
2190  double EMaxSeed = inputvars[18];
2191  double E2ndSeed = inputvars[19];
2192  double ETopSeed = inputvars[20];
2193  double EBottomSeed = inputvars[21];
2194  double ELeftSeed = inputvars[22];
2195  double ERightSeed = inputvars[23];
2196  double E2x5MaxSeed = inputvars[24];
2197  double E2x5TopSeed = inputvars[25];
2198  double E2x5BottomSeed = inputvars[26];
2199  double E2x5LeftSeed = inputvars[27];
2200  double E2x5RightSeed = inputvars[28];
2201  double IEtaSeed = inputvars[29];
2202  double IPhiSeed = inputvars[30];
2203  double EtaCrySeed = inputvars[31];
2204  double PhiCrySeed = inputvars[32];
2205  double PreShowerOverRaw = inputvars[33];
2206  int IsEcalDriven = inputvars[34];
2207  double GsfTrackPIn = inputvars[35];
2208  double fbrem = inputvars[36];
2209  double Charge = inputvars[37];
2210  double EoP = inputvars[38];
2211  double TrackMomentumError = inputvars[39];
2212  double EcalEnergyError = inputvars[40];
2213  int Classification = inputvars[41];
2214 
2215 
2216  float *vals = (fabs(scEta) <= 1.479) ? new float[46] : new float[39];
2217  if (fabs(scEta) <= 1.479) { // Barrel
2218  vals[0] = SCRawEnergy;
2219  vals[1] = scEta;
2220  vals[2] = scPhi;
2221  vals[3] = R9;
2222  vals[4] = E5x5Seed/SCRawEnergy;
2223  vals[5] = etawidth;
2224  vals[6] = phiwidth;
2225  vals[7] = NClusters;
2226  vals[8] = HoE;
2227  vals[9] = rho;
2228  vals[10] = vertices;
2229  vals[11] = EtaSeed - scEta;
2230  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2231  vals[13] = ESeed/SCRawEnergy;
2232  vals[14] = E3x3Seed/ESeed;
2233  vals[15] = E5x5Seed/ESeed;
2234  vals[16] = see;
2235  vals[17] = spp;
2236  vals[18] = sep;
2237  vals[19] = EMaxSeed/ESeed;
2238  vals[20] = E2ndSeed/ESeed;
2239  vals[21] = ETopSeed/ESeed;
2240  vals[22] = EBottomSeed/ESeed;
2241  vals[23] = ELeftSeed/ESeed;
2242  vals[24] = ERightSeed/ESeed;
2243  vals[25] = E2x5MaxSeed/ESeed;
2244  vals[26] = E2x5TopSeed/ESeed;
2245  vals[27] = E2x5BottomSeed/ESeed;
2246  vals[28] = E2x5LeftSeed/ESeed;
2247  vals[29] = E2x5RightSeed/ESeed;
2248  vals[30] = IsEcalDriven;
2249  vals[31] = GsfTrackPIn;
2250  vals[32] = fbrem;
2251  vals[33] = Charge;
2252  vals[34] = EoP;
2253  vals[35] = TrackMomentumError/GsfTrackPIn;
2254  vals[36] = EcalEnergyError/SCRawEnergy;
2255  vals[37] = Classification;
2256  vals[38] = IEtaSeed;
2257  vals[39] = IPhiSeed;
2258  vals[40] = ((int) IEtaSeed)%5;
2259  vals[41] = ((int) IPhiSeed)%2;
2260  vals[42] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
2261  vals[43] = ((int) IPhiSeed)%20;
2262  vals[44] = EtaCrySeed;
2263  vals[45] = PhiCrySeed;
2264  }
2265 
2266  else { // Endcap
2267  vals[0] = SCRawEnergy;
2268  vals[1] = scEta;
2269  vals[2] = scPhi;
2270  vals[3] = R9;
2271  vals[4] = E5x5Seed/SCRawEnergy;
2272  vals[5] = etawidth;
2273  vals[6] = phiwidth;
2274  vals[7] = NClusters;
2275  vals[8] = HoE;
2276  vals[9] = rho;
2277  vals[10] = vertices;
2278  vals[11] = EtaSeed - scEta;
2279  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2280  vals[13] = ESeed/SCRawEnergy;
2281  vals[14] = E3x3Seed/ESeed;
2282  vals[15] = E5x5Seed/ESeed;
2283  vals[16] = see;
2284  vals[17] = spp;
2285  vals[18] = sep;
2286  vals[19] = EMaxSeed/ESeed;
2287  vals[20] = E2ndSeed/ESeed;
2288  vals[21] = ETopSeed/ESeed;
2289  vals[22] = EBottomSeed/ESeed;
2290  vals[23] = ELeftSeed/ESeed;
2291  vals[24] = ERightSeed/ESeed;
2292  vals[25] = E2x5MaxSeed/ESeed;
2293  vals[26] = E2x5TopSeed/ESeed;
2294  vals[27] = E2x5BottomSeed/ESeed;
2295  vals[28] = E2x5LeftSeed/ESeed;
2296  vals[29] = E2x5RightSeed/ESeed;
2297  vals[30] = IsEcalDriven;
2298  vals[31] = GsfTrackPIn;
2299  vals[32] = fbrem;
2300  vals[33] = Charge;
2301  vals[34] = EoP;
2302  vals[35] = TrackMomentumError/GsfTrackPIn;
2303  vals[36] = EcalEnergyError/SCRawEnergy;
2304  vals[37] = Classification;
2305  vals[38] = PreShowerOverRaw;
2306  }
2307 
2308  // Now evaluating the regression
2309  double regressionResult = 0;
2310 
2311  if (fVersionType == kWithTrkVarV1) {
2312  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
2313  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
2314  }
2315 
2316  //print debug
2317  if (printDebug) {
2318  if (fabs(scEta) <= 1.479) {
2319  std::cout << "Barrel :";
2320  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
2321  std::cout << "\n";
2322  }
2323  else {
2324  std::cout << "Endcap :";
2325  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
2326  std::cout << "\n";
2327  }
2328  std::cout << " SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2329  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
2330  }
2331 
2332 
2333  // Cleaning up and returning
2334  delete[] vals;
2335  return regressionResult;
2336 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV2 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  TrackMomentumError,
double  EcalEnergyError,
int  Classification,
double  detaIn,
double  dphiIn,
double  detaCalo,
double  dphiCalo,
double  GsfTrackChiSqr,
double  KFTrackNLayers,
double  ElectronEnergyOverPout,
bool  printDebug = false 
)

Definition at line 2540 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergyUncertainty().

2591 {
2592  // Checking if instance has been initialized
2593  if (fIsInitialized == kFALSE) {
2594  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2595  return 0;
2596  }
2597 
2598  // Checking if fVersionType is correct
2599  assert(fVersionType == kWithTrkVarV2);
2600 
2601  float *vals = (fabs(scEta) <= 1.479) ? new float[53] : new float[46];
2602  if (fabs(scEta) <= 1.479) { // Barrel
2603  vals[0] = SCRawEnergy;
2604  vals[1] = scEta;
2605  vals[2] = scPhi;
2606  vals[3] = R9;
2607  vals[4] = E5x5Seed/SCRawEnergy;
2608  vals[5] = etawidth;
2609  vals[6] = phiwidth;
2610  vals[7] = NClusters;
2611  vals[8] = HoE;
2612  vals[9] = rho;
2613  vals[10] = vertices;
2614  vals[11] = EtaSeed - scEta;
2615  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2616  vals[13] = ESeed/SCRawEnergy;
2617  vals[14] = E3x3Seed/ESeed;
2618  vals[15] = E5x5Seed/ESeed;
2619  vals[16] = see;
2620  vals[17] = spp;
2621  vals[18] = sep;
2622  vals[19] = EMaxSeed/ESeed;
2623  vals[20] = E2ndSeed/ESeed;
2624  vals[21] = ETopSeed/ESeed;
2625  vals[22] = EBottomSeed/ESeed;
2626  vals[23] = ELeftSeed/ESeed;
2627  vals[24] = ERightSeed/ESeed;
2628  vals[25] = E2x5MaxSeed/ESeed;
2629  vals[26] = E2x5TopSeed/ESeed;
2630  vals[27] = E2x5BottomSeed/ESeed;
2631  vals[28] = E2x5LeftSeed/ESeed;
2632  vals[29] = E2x5RightSeed/ESeed;
2633  vals[30] = IsEcalDriven;
2634  vals[31] = GsfTrackPIn;
2635  vals[32] = fbrem;
2636  vals[33] = Charge;
2637  vals[34] = EoP;
2638  vals[35] = TrackMomentumError/GsfTrackPIn;
2639  vals[36] = EcalEnergyError/SCRawEnergy;
2640  vals[37] = Classification;
2641  vals[38] = detaIn;
2642  vals[39] = dphiIn;
2643  vals[40] = detaCalo;
2644  vals[41] = dphiCalo;
2645  vals[42] = GsfTrackChiSqr;
2646  vals[43] = KFTrackNLayers;
2647  vals[44] = ElectronEnergyOverPout;
2648  vals[45] = IEtaSeed;
2649  vals[46] = IPhiSeed;
2650  vals[47] = ((int) IEtaSeed)%5;
2651  vals[48] = ((int) IPhiSeed)%2;
2652  vals[49] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
2653  vals[50] = ((int) IPhiSeed)%20;
2654  vals[51] = EtaCrySeed;
2655  vals[52] = PhiCrySeed;
2656  }
2657 
2658  else { // Endcap
2659  vals[0] = SCRawEnergy;
2660  vals[1] = scEta;
2661  vals[2] = scPhi;
2662  vals[3] = R9;
2663  vals[4] = E5x5Seed/SCRawEnergy;
2664  vals[5] = etawidth;
2665  vals[6] = phiwidth;
2666  vals[7] = NClusters;
2667  vals[8] = HoE;
2668  vals[9] = rho;
2669  vals[10] = vertices;
2670  vals[11] = EtaSeed - scEta;
2671  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2672  vals[13] = ESeed/SCRawEnergy;
2673  vals[14] = E3x3Seed/ESeed;
2674  vals[15] = E5x5Seed/ESeed;
2675  vals[16] = see;
2676  vals[17] = spp;
2677  vals[18] = sep;
2678  vals[19] = EMaxSeed/ESeed;
2679  vals[20] = E2ndSeed/ESeed;
2680  vals[21] = ETopSeed/ESeed;
2681  vals[22] = EBottomSeed/ESeed;
2682  vals[23] = ELeftSeed/ESeed;
2683  vals[24] = ERightSeed/ESeed;
2684  vals[25] = E2x5MaxSeed/ESeed;
2685  vals[26] = E2x5TopSeed/ESeed;
2686  vals[27] = E2x5BottomSeed/ESeed;
2687  vals[28] = E2x5LeftSeed/ESeed;
2688  vals[29] = E2x5RightSeed/ESeed;
2689  vals[30] = IsEcalDriven;
2690  vals[31] = GsfTrackPIn;
2691  vals[32] = fbrem;
2692  vals[33] = Charge;
2693  vals[34] = EoP;
2694  vals[35] = TrackMomentumError/GsfTrackPIn;
2695  vals[36] = EcalEnergyError/SCRawEnergy;
2696  vals[37] = Classification;
2697  vals[38] = detaIn;
2698  vals[39] = dphiIn;
2699  vals[40] = detaCalo;
2700  vals[41] = dphiCalo;
2701  vals[42] = GsfTrackChiSqr;
2702  vals[43] = KFTrackNLayers;
2703  vals[44] = ElectronEnergyOverPout;
2704  vals[45] = PreShowerOverRaw;
2705  }
2706 
2707  // Now evaluating the regression
2708  double regressionResult = 0;
2709 
2710  if (fVersionType == kWithTrkVarV2) {
2711  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
2712  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
2713  }
2714 
2715  //print debug
2716  if (printDebug) {
2717  if (fabs(scEta) <= 1.479) {
2718  std::cout << "Barrel :";
2719  for (unsigned int v=0; v < 53; ++v) std::cout << vals[v] << ", ";
2720  std::cout << "\n";
2721  }
2722  else {
2723  std::cout << "Endcap :";
2724  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
2725  std::cout << "\n";
2726  }
2727  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2728  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
2729  }
2730 
2731 
2732  // Cleaning up and returning
2733  delete[] vals;
2734  return regressionResult;
2735 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV2 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2944 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

2946 {
2947  // Checking if instance has been initialized
2948  if (fIsInitialized == kFALSE) {
2949  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2950  return 0;
2951  }
2952 
2953  // Checking if fVersionType is correct
2954  assert(fVersionType == kWithTrkVarV2);
2955 
2956  // Checking if fVersionType is correct
2957  assert(inputvars.size() == 49);
2958 
2959  double SCRawEnergy = inputvars[0];
2960  double scEta = inputvars[1];
2961  double scPhi = inputvars[2];
2962  double R9 = inputvars[3];
2963  double etawidth = inputvars[4];
2964  double phiwidth = inputvars[5];
2965  double NClusters = inputvars[6];
2966  double HoE = inputvars[7];
2967  double rho = inputvars[8];
2968  double vertices = inputvars[9];
2969  double EtaSeed = inputvars[10];
2970  double PhiSeed = inputvars[11];
2971  double ESeed = inputvars[12];
2972  double E3x3Seed = inputvars[13];
2973  double E5x5Seed = inputvars[14];
2974  double see = inputvars[15];
2975  double spp = inputvars[16];
2976  double sep = inputvars[17];
2977  double EMaxSeed = inputvars[18];
2978  double E2ndSeed = inputvars[19];
2979  double ETopSeed = inputvars[20];
2980  double EBottomSeed = inputvars[21];
2981  double ELeftSeed = inputvars[22];
2982  double ERightSeed = inputvars[23];
2983  double E2x5MaxSeed = inputvars[24];
2984  double E2x5TopSeed = inputvars[25];
2985  double E2x5BottomSeed = inputvars[26];
2986  double E2x5LeftSeed = inputvars[27];
2987  double E2x5RightSeed = inputvars[28];
2988  double IEtaSeed = inputvars[29];
2989  double IPhiSeed = inputvars[30];
2990  double EtaCrySeed = inputvars[31];
2991  double PhiCrySeed = inputvars[32];
2992  double PreShowerOverRaw = inputvars[33];
2993  int IsEcalDriven = inputvars[34];
2994  double GsfTrackPIn = inputvars[35];
2995  double fbrem = inputvars[36];
2996  double Charge = inputvars[37];
2997  double EoP = inputvars[38];
2998  double TrackMomentumError = inputvars[39];
2999  double EcalEnergyError = inputvars[40];
3000  int Classification = inputvars[41];
3001  double detaIn = inputvars[42];
3002  double dphiIn = inputvars[43];
3003  double detaCalo = inputvars[44];
3004  double dphiCalo = inputvars[45];
3005  double GsfTrackChiSqr = inputvars[46];
3006  double KFTrackNLayers = inputvars[47];
3007  double ElectronEnergyOverPout = inputvars[48];
3008 
3009  float *vals = (fabs(scEta) <= 1.479) ? new float[53] : new float[46];
3010  if (fabs(scEta) <= 1.479) { // Barrel
3011  vals[0] = SCRawEnergy;
3012  vals[1] = scEta;
3013  vals[2] = scPhi;
3014  vals[3] = R9;
3015  vals[4] = E5x5Seed/SCRawEnergy;
3016  vals[5] = etawidth;
3017  vals[6] = phiwidth;
3018  vals[7] = NClusters;
3019  vals[8] = HoE;
3020  vals[9] = rho;
3021  vals[10] = vertices;
3022  vals[11] = EtaSeed - scEta;
3023  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3024  vals[13] = ESeed/SCRawEnergy;
3025  vals[14] = E3x3Seed/ESeed;
3026  vals[15] = E5x5Seed/ESeed;
3027  vals[16] = see;
3028  vals[17] = spp;
3029  vals[18] = sep;
3030  vals[19] = EMaxSeed/ESeed;
3031  vals[20] = E2ndSeed/ESeed;
3032  vals[21] = ETopSeed/ESeed;
3033  vals[22] = EBottomSeed/ESeed;
3034  vals[23] = ELeftSeed/ESeed;
3035  vals[24] = ERightSeed/ESeed;
3036  vals[25] = E2x5MaxSeed/ESeed;
3037  vals[26] = E2x5TopSeed/ESeed;
3038  vals[27] = E2x5BottomSeed/ESeed;
3039  vals[28] = E2x5LeftSeed/ESeed;
3040  vals[29] = E2x5RightSeed/ESeed;
3041  vals[30] = IsEcalDriven;
3042  vals[31] = GsfTrackPIn;
3043  vals[32] = fbrem;
3044  vals[33] = Charge;
3045  vals[34] = EoP;
3046  vals[35] = TrackMomentumError/GsfTrackPIn;
3047  vals[36] = EcalEnergyError/SCRawEnergy;
3048  vals[37] = Classification;
3049  vals[38] = detaIn;
3050  vals[39] = dphiIn;
3051  vals[40] = detaCalo;
3052  vals[41] = dphiCalo;
3053  vals[42] = GsfTrackChiSqr;
3054  vals[43] = KFTrackNLayers;
3055  vals[44] = ElectronEnergyOverPout;
3056  vals[45] = IEtaSeed;
3057  vals[46] = IPhiSeed;
3058  vals[47] = ((int) IEtaSeed)%5;
3059  vals[48] = ((int) IPhiSeed)%2;
3060  vals[49] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
3061  vals[50] = ((int) IPhiSeed)%20;
3062  vals[51] = EtaCrySeed;
3063  vals[52] = PhiCrySeed;
3064  }
3065 
3066  else { // Endcap
3067  vals[0] = SCRawEnergy;
3068  vals[1] = scEta;
3069  vals[2] = scPhi;
3070  vals[3] = R9;
3071  vals[4] = E5x5Seed/SCRawEnergy;
3072  vals[5] = etawidth;
3073  vals[6] = phiwidth;
3074  vals[7] = NClusters;
3075  vals[8] = HoE;
3076  vals[9] = rho;
3077  vals[10] = vertices;
3078  vals[11] = EtaSeed - scEta;
3079  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3080  vals[13] = ESeed/SCRawEnergy;
3081  vals[14] = E3x3Seed/ESeed;
3082  vals[15] = E5x5Seed/ESeed;
3083  vals[16] = see;
3084  vals[17] = spp;
3085  vals[18] = sep;
3086  vals[19] = EMaxSeed/ESeed;
3087  vals[20] = E2ndSeed/ESeed;
3088  vals[21] = ETopSeed/ESeed;
3089  vals[22] = EBottomSeed/ESeed;
3090  vals[23] = ELeftSeed/ESeed;
3091  vals[24] = ERightSeed/ESeed;
3092  vals[25] = E2x5MaxSeed/ESeed;
3093  vals[26] = E2x5TopSeed/ESeed;
3094  vals[27] = E2x5BottomSeed/ESeed;
3095  vals[28] = E2x5LeftSeed/ESeed;
3096  vals[29] = E2x5RightSeed/ESeed;
3097  vals[30] = IsEcalDriven;
3098  vals[31] = GsfTrackPIn;
3099  vals[32] = fbrem;
3100  vals[33] = Charge;
3101  vals[34] = EoP;
3102  vals[35] = TrackMomentumError/GsfTrackPIn;
3103  vals[36] = EcalEnergyError/SCRawEnergy;
3104  vals[37] = Classification;
3105  vals[38] = detaIn;
3106  vals[39] = dphiIn;
3107  vals[40] = detaCalo;
3108  vals[41] = dphiCalo;
3109  vals[42] = GsfTrackChiSqr;
3110  vals[43] = KFTrackNLayers;
3111  vals[44] = ElectronEnergyOverPout;
3112  vals[45] = PreShowerOverRaw;
3113  }
3114 
3115  // Now evaluating the regression
3116  double regressionResult = 0;
3117 
3118  if (fVersionType == kWithTrkVarV2) {
3119  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
3120  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
3121  }
3122 
3123  //print debug
3124  if (printDebug) {
3125  if (fabs(scEta) <= 1.479) {
3126  std::cout << "Barrel :";
3127  for (unsigned int v=0; v < 53; ++v) std::cout << vals[v] << ", ";
3128  std::cout << "\n";
3129  }
3130  else {
3131  std::cout << "Endcap :";
3132  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
3133  std::cout << "\n";
3134  }
3135  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3136  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
3137  }
3138 
3139 
3140  // Cleaning up and returning
3141  delete[] vals;
3142  return regressionResult;
3143 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueNoTrkVar ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
bool  printDebug = false 
)

Definition at line 605 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kNoTrkVar, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergy().

641 {
642  // Checking if instance has been initialized
643  if (fIsInitialized == kFALSE) {
644  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
645  return 0;
646  }
647 
648  // Checking if type is correct
649  if (!(fVersionType == kNoTrkVar)) {
650  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueNoTrkVar.\n";
651  return 0;
652  }
653  assert(forestCorrection_ee);
654 
655  // Now applying regression according to version and (endcap/barrel)
656  float *vals = (fabs(scEta) <= 1.479) ? new float[38] : new float[31];
657  if (fabs(scEta) <= 1.479) { // Barrel
658  vals[0] = SCRawEnergy;
659  vals[1] = scEta;
660  vals[2] = scPhi;
661  vals[3] = R9;
662  vals[4] = E5x5Seed/SCRawEnergy;
663  vals[5] = etawidth;
664  vals[6] = phiwidth;
665  vals[7] = NClusters;
666  vals[8] = HoE;
667  vals[9] = rho;
668  vals[10] = vertices;
669  vals[11] = EtaSeed - scEta;
670  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
671  vals[13] = ESeed/SCRawEnergy;
672  vals[14] = E3x3Seed/ESeed;
673  vals[15] = E5x5Seed/ESeed;
674  vals[16] = see;
675  vals[17] = spp;
676  vals[18] = sep;
677  vals[19] = EMaxSeed/ESeed;
678  vals[20] = E2ndSeed/ESeed;
679  vals[21] = ETopSeed/ESeed;
680  vals[22] = EBottomSeed/ESeed;
681  vals[23] = ELeftSeed/ESeed;
682  vals[24] = ERightSeed/ESeed;
683  vals[25] = E2x5MaxSeed/ESeed;
684  vals[26] = E2x5TopSeed/ESeed;
685  vals[27] = E2x5BottomSeed/ESeed;
686  vals[28] = E2x5LeftSeed/ESeed;
687  vals[29] = E2x5RightSeed/ESeed;
688  vals[30] = IEtaSeed;
689  vals[31] = IPhiSeed;
690  vals[32] = ((int) IEtaSeed)%5;
691  vals[33] = ((int) IPhiSeed)%2;
692  vals[34] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
693  vals[35] = ((int) IPhiSeed)%20;
694  vals[36] = EtaCrySeed;
695  vals[37] = PhiCrySeed;
696  }
697  else { // Endcap
698  vals[0] = SCRawEnergy;
699  vals[1] = scEta;
700  vals[2] = scPhi;
701  vals[3] = R9;
702  vals[4] = E5x5Seed/SCRawEnergy;
703  vals[5] = etawidth;
704  vals[6] = phiwidth;
705  vals[7] = NClusters;
706  vals[8] = HoE;
707  vals[9] = rho;
708  vals[10] = vertices;
709  vals[11] = EtaSeed - scEta;
710  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
711  vals[13] = ESeed/SCRawEnergy;
712  vals[14] = E3x3Seed/ESeed;
713  vals[15] = E5x5Seed/ESeed;
714  vals[16] = see;
715  vals[17] = spp;
716  vals[18] = sep;
717  vals[19] = EMaxSeed/ESeed;
718  vals[20] = E2ndSeed/ESeed;
719  vals[21] = ETopSeed/ESeed;
720  vals[22] = EBottomSeed/ESeed;
721  vals[23] = ELeftSeed/ESeed;
722  vals[24] = ERightSeed/ESeed;
723  vals[25] = E2x5MaxSeed/ESeed;
724  vals[26] = E2x5TopSeed/ESeed;
725  vals[27] = E2x5BottomSeed/ESeed;
726  vals[28] = E2x5LeftSeed/ESeed;
727  vals[29] = E2x5RightSeed/ESeed;
728  vals[30] = PreShowerOverRaw;
729  }
730 
731  // Now evaluating the regression
732  double regressionResult = 0;
733  Int_t BinIndex = -1;
734 
735  if (fVersionType == kNoTrkVar) {
736  if (fabs(scEta) <= 1.479) {
737  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
738  BinIndex = 0;
739  }
740  else {
741  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
742  BinIndex = 1;
743  }
744  }
745 
746  //print debug
747  if (printDebug) {
748  if ( fabs(scEta) <= 1.479) {
749  std::cout << "Barrel :";
750  for (unsigned int v=0; v < 38; ++v) std::cout << vals[v] << ", ";
751  std::cout << "\n";
752  }
753  else {
754  std::cout << "Endcap :";
755  for (unsigned int v=0; v < 31; ++v) std::cout << vals[v] << ", ";
756  std::cout << "\n";
757  }
758  std::cout << "BinIndex : " << BinIndex << "\n";
759  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
760  std::cout << "regression energy = " << regressionResult << std::endl;
761  }
762 
763 
764  // Cleaning up and returning
765  delete[] vals;
766  return regressionResult;
767 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueNoTrkVarV1 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
bool  printDebug = false 
)

Definition at line 935 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kNoTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergy().

972 {
973  // Checking if instance has been initialized
974  if (fIsInitialized == kFALSE) {
975  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
976  return 0;
977  }
978 
979  // Checking if type is correct
980  if (!(fVersionType == kNoTrkVarV1)) {
981  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueNoTrkVar.\n";
982  return 0;
983  }
984 
985  // Now applying regression according to version and (endcap/barrel)
986  float *vals = (fabs(scEta) <= 1.479) ? new float[39] : new float[32];
987  if (fabs(scEta) <= 1.479) { // Barrel
988  vals[0] = SCRawEnergy;
989  vals[1] = scEta;
990  vals[2] = scPhi;
991  vals[3] = R9;
992  vals[4] = E5x5Seed/SCRawEnergy;
993  vals[5] = etawidth;
994  vals[6] = phiwidth;
995  vals[7] = NClusters;
996  vals[8] = HoE;
997  vals[9] = rho;
998  vals[10] = vertices;
999  vals[11] = EtaSeed - scEta;
1000  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1001  vals[13] = ESeed/SCRawEnergy;
1002  vals[14] = E3x3Seed/ESeed;
1003  vals[15] = E5x5Seed/ESeed;
1004  vals[16] = see;
1005  vals[17] = spp;
1006  vals[18] = sep;
1007  vals[19] = EMaxSeed/ESeed;
1008  vals[20] = E2ndSeed/ESeed;
1009  vals[21] = ETopSeed/ESeed;
1010  vals[22] = EBottomSeed/ESeed;
1011  vals[23] = ELeftSeed/ESeed;
1012  vals[24] = ERightSeed/ESeed;
1013  vals[25] = E2x5MaxSeed/ESeed;
1014  vals[26] = E2x5TopSeed/ESeed;
1015  vals[27] = E2x5BottomSeed/ESeed;
1016  vals[28] = E2x5LeftSeed/ESeed;
1017  vals[29] = E2x5RightSeed/ESeed;
1018  vals[30] = IsEcalDriven;
1019  vals[31] = IEtaSeed;
1020  vals[32] = IPhiSeed;
1021  vals[33] = ((int) IEtaSeed)%5;
1022  vals[34] = ((int) IPhiSeed)%2;
1023  vals[35] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1024  vals[36] = ((int) IPhiSeed)%20;
1025  vals[37] = EtaCrySeed;
1026  vals[38] = PhiCrySeed;
1027  }
1028  else { // Endcap
1029  vals[0] = SCRawEnergy;
1030  vals[1] = scEta;
1031  vals[2] = scPhi;
1032  vals[3] = R9;
1033  vals[4] = E5x5Seed/SCRawEnergy;
1034  vals[5] = etawidth;
1035  vals[6] = phiwidth;
1036  vals[7] = NClusters;
1037  vals[8] = HoE;
1038  vals[9] = rho;
1039  vals[10] = vertices;
1040  vals[11] = EtaSeed - scEta;
1041  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1042  vals[13] = ESeed/SCRawEnergy;
1043  vals[14] = E3x3Seed/ESeed;
1044  vals[15] = E5x5Seed/ESeed;
1045  vals[16] = see;
1046  vals[17] = spp;
1047  vals[18] = sep;
1048  vals[19] = EMaxSeed/ESeed;
1049  vals[20] = E2ndSeed/ESeed;
1050  vals[21] = ETopSeed/ESeed;
1051  vals[22] = EBottomSeed/ESeed;
1052  vals[23] = ELeftSeed/ESeed;
1053  vals[24] = ERightSeed/ESeed;
1054  vals[25] = E2x5MaxSeed/ESeed;
1055  vals[26] = E2x5TopSeed/ESeed;
1056  vals[27] = E2x5BottomSeed/ESeed;
1057  vals[28] = E2x5LeftSeed/ESeed;
1058  vals[29] = E2x5RightSeed/ESeed;
1059  vals[30] = IsEcalDriven;
1060  vals[31] = PreShowerOverRaw;
1061  }
1062 
1063  // Now evaluating the regression
1064  double regressionResult = 0;
1065  Int_t BinIndex = -1;
1066 
1067  if (fVersionType == kNoTrkVarV1) {
1068  if (fabs(scEta) <= 1.479) {
1069  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1070  BinIndex = 0;
1071  }
1072  else {
1073  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1074  BinIndex = 1;
1075  }
1076  }
1077 
1078  //print debug
1079  if (printDebug) {
1080  if ( fabs(scEta) <= 1.479) {
1081  std::cout << "Barrel :";
1082  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
1083  std::cout << "\n";
1084  }
1085  else {
1086  std::cout << "Endcap :";
1087  for (unsigned int v=0; v < 32; ++v) std::cout << vals[v] << ", ";
1088  std::cout << "\n";
1089  }
1090  std::cout << "BinIndex : " << BinIndex << "\n";
1091  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1092  std::cout << "regression energy = " << regressionResult << std::endl;
1093  }
1094 
1095 
1096  // Cleaning up and returning
1097  delete[] vals;
1098  return regressionResult;
1099 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithSubClusters ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
double  isEcalDriven,
double  isEtaGap,
double  isPhiGap,
double  isDeeGap,
double  ESubs,
double  ESub1,
double  EtaSub1,
double  PhiSub1,
double  EMaxSub1,
double  E3x3Sub1,
double  ESub2,
double  EtaSub2,
double  PhiSub2,
double  EMaxSub2,
double  E3x3Sub2,
double  ESub3,
double  EtaSub3,
double  PhiSub3,
double  EMaxSub3,
double  E3x3Sub3,
double  NPshwClusters,
double  EPshwSubs,
double  EPshwSub1,
double  EtaPshwSub1,
double  PhiPshwSub1,
double  EPshwSub2,
double  EtaPshwSub2,
double  PhiPshwSub2,
double  EPshwSub3,
double  EtaPshwSub3,
double  PhiPshwSub3,
bool  isEB,
bool  printDebug = false 
)

Definition at line 3145 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithSubCluVar, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergy().

3213 {
3214 
3215  // Checking if instance has been initialized
3216  if (fIsInitialized == kFALSE) {
3217  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
3218  return 0;
3219  }
3220 
3221  // Checking if type is correct
3222  if (!(fVersionType == kWithSubCluVar)) {
3223  std::cout << "Error: Regression VersionType " << fVersionType << " is not supported to use function regressionValueWithSubClusters.\n";
3224  return 0;
3225  }
3226 
3227 
3228 
3229  // Now applying regression according to version and (endcap/barrel)
3230  float *vals = (isEB) ? new float[61] : new float[65];
3231  if (isEB) { // Barrel
3232  vals[0] = rho;
3233  vals[1] = vertices;
3234  vals[2] = isEcalDriven;
3235  vals[3] = isEtaGap;
3236  vals[4] = isPhiGap;
3237  vals[5] = isDeeGap;
3238  vals[6] = SCRawEnergy;
3239  vals[7] = scEta;
3240  vals[8] = scPhi;
3241  vals[9] = R9;
3242  vals[10] = etawidth;
3243  vals[11] = phiwidth;
3244  vals[12] = NClusters;
3245  vals[13] = HoE;
3246  vals[14] = EtaSeed - scEta;
3247  vals[15] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3248  vals[16] = ESeed/SCRawEnergy;
3249  vals[17] = E3x3Seed/ESeed;
3250  vals[18] = E5x5Seed/SCRawEnergy;
3251  vals[19] = E5x5Seed/ESeed;
3252  vals[20] = EMaxSeed/ESeed;
3253  vals[21] = E2ndSeed/ESeed;
3254  vals[22] = ETopSeed/ESeed;
3255  vals[23] = EBottomSeed/ESeed;
3256  vals[24] = ELeftSeed/ESeed;
3257  vals[25] = ERightSeed/ESeed;
3258  vals[26] = E2x5MaxSeed/ESeed;
3259  vals[27] = E2x5TopSeed/ESeed;
3260  vals[28] = E2x5BottomSeed/ESeed;
3261  vals[29] = E2x5LeftSeed/ESeed;
3262  vals[30] = E2x5RightSeed/ESeed;
3263  vals[31] = see;
3264  vals[32] = spp;
3265  vals[33] = sep;
3266  vals[34] = phiwidth/etawidth;
3267  vals[35] = (ELeftSeed+ERightSeed==0. ? 0. : (ELeftSeed-ERightSeed)/(ELeftSeed+ERightSeed));
3268  vals[36] = (ETopSeed+EBottomSeed==0. ? 0. : (ETopSeed-EBottomSeed)/(ETopSeed+EBottomSeed));
3269  vals[37] = ESubs/SCRawEnergy;
3270  vals[38] = ESub1/SCRawEnergy;
3271  vals[39] = (NClusters<=1 ? 999. : EtaSub1-EtaSeed);
3272  vals[40] = (NClusters<=1 ? 999. : atan2(sin(PhiSub1-PhiSeed),cos(PhiSub1-PhiSeed)));
3273  vals[41] = (NClusters<=1 ? 0. : EMaxSub1/ESub1);
3274  vals[42] = (NClusters<=1 ? 0. : E3x3Sub1/ESub1);
3275  vals[43] = ESub2/SCRawEnergy;
3276  vals[44] = (NClusters<=2 ? 999. : EtaSub2-EtaSeed);
3277  vals[45] = (NClusters<=2 ? 999. : atan2(sin(PhiSub2-PhiSeed),cos(PhiSub2-PhiSeed)));
3278  vals[46] = (NClusters<=2 ? 0. : EMaxSub2/ESub2);
3279  vals[47] = (NClusters<=2 ? 0. : E3x3Sub2/ESub2);
3280  vals[48] = ESub3/SCRawEnergy;
3281  vals[49] = (NClusters<=3 ? 999. : EtaSub3-EtaSeed);
3282  vals[50] = (NClusters<=3 ? 999. : atan2(sin(PhiSub3-PhiSeed),cos(PhiSub3-PhiSeed)));
3283  vals[51] = (NClusters<=3 ? 0. : EMaxSub3/ESub3);
3284  vals[52] = (NClusters<=3 ? 0. : E3x3Sub3/ESub3);
3285  vals[53] = IEtaSeed;
3286  vals[54] = ((int) IEtaSeed)%5;
3287  vals[55] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
3288  vals[56] = IPhiSeed;
3289  vals[57] = ((int) IPhiSeed)%2;
3290  vals[58] = ((int) IPhiSeed)%20;
3291  vals[59] = EtaCrySeed;
3292  vals[60] = PhiCrySeed;
3293  }
3294  else { // Endcap
3295  vals[0] = rho;
3296  vals[1] = vertices;
3297  vals[2] = isEcalDriven;
3298  vals[3] = isEtaGap;
3299  vals[4] = isPhiGap;
3300  vals[5] = isDeeGap;
3301  vals[6] = SCRawEnergy;
3302  vals[7] = scEta;
3303  vals[8] = scPhi;
3304  vals[9] = R9;
3305  vals[10] = etawidth;
3306  vals[11] = phiwidth;
3307  vals[12] = NClusters;
3308  vals[13] = HoE;
3309  vals[14] = EtaSeed - scEta;
3310  vals[15] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
3311  vals[16] = ESeed/SCRawEnergy;
3312  vals[17] = E3x3Seed/ESeed;
3313  vals[18] = E5x5Seed/SCRawEnergy;
3314  vals[19] = E5x5Seed/ESeed;
3315  vals[20] = EMaxSeed/ESeed;
3316  vals[21] = E2ndSeed/ESeed;
3317  vals[22] = ETopSeed/ESeed;
3318  vals[23] = EBottomSeed/ESeed;
3319  vals[24] = ELeftSeed/ESeed;
3320  vals[25] = ERightSeed/ESeed;
3321  vals[26] = E2x5MaxSeed/ESeed;
3322  vals[27] = E2x5TopSeed/ESeed;
3323  vals[28] = E2x5BottomSeed/ESeed;
3324  vals[29] = E2x5LeftSeed/ESeed;
3325  vals[30] = E2x5RightSeed/ESeed;
3326  vals[31] = see;
3327  vals[32] = spp;
3328  vals[33] = sep;
3329  vals[34] = phiwidth/etawidth;
3330  vals[35] = (ELeftSeed+ERightSeed==0. ? 0. : (ELeftSeed-ERightSeed)/(ELeftSeed+ERightSeed));
3331  vals[36] = (ETopSeed+EBottomSeed==0. ? 0. : (ETopSeed-EBottomSeed)/(ETopSeed+EBottomSeed));
3332  vals[37] = ESubs/SCRawEnergy;
3333  vals[38] = ESub1/SCRawEnergy;
3334  vals[39] = (NClusters<=1 ? 999. : EtaSub1-EtaSeed);
3335  vals[40] = (NClusters<=1 ? 999. : atan2(sin(PhiSub1-PhiSeed),cos(PhiSub1-PhiSeed)));
3336  vals[41] = (NClusters<=1 ? 0. : EMaxSub1/ESub1);
3337  vals[42] = (NClusters<=1 ? 0. : E3x3Sub1/ESub1);
3338  vals[43] = ESub2/SCRawEnergy;
3339  vals[44] = (NClusters<=2 ? 999. : EtaSub2-EtaSeed);
3340  vals[45] = (NClusters<=2 ? 999. : atan2(sin(PhiSub2-PhiSeed),cos(PhiSub2-PhiSeed)));
3341  vals[46] = (NClusters<=2 ? 0. : EMaxSub2/ESub2);
3342  vals[47] = (NClusters<=2 ? 0. : E3x3Sub2/ESub2);
3343  vals[48] = ESub3/SCRawEnergy;
3344  vals[49] = (NClusters<=3 ? 999. : EtaSub3-EtaSeed);
3345  vals[50] = (NClusters<=3 ? 999. : atan2(sin(PhiSub3-PhiSeed),cos(PhiSub3-PhiSeed)));
3346  vals[51] = (NClusters<=3 ? 0. : EMaxSub3/ESub3);
3347  vals[52] = (NClusters<=3 ? 0. : E3x3Sub3/ESub3);
3348  vals[53] = PreShowerOverRaw;
3349  vals[54] = NPshwClusters;
3350  vals[55] = EPshwSubs/SCRawEnergy;
3351  vals[56] = EPshwSub1/SCRawEnergy;
3352  vals[57] = (NPshwClusters==0 ? 999. : EtaPshwSub1-EtaSeed);
3353  vals[58] = (NPshwClusters==0 ? 999. : atan2(sin(PhiPshwSub1-PhiSeed),cos(PhiPshwSub1-PhiSeed)));
3354  vals[59] = EPshwSub2/SCRawEnergy;
3355  vals[60] = (NPshwClusters<=1 ? 999. : EtaPshwSub2-EtaSeed);
3356  vals[61] = (NPshwClusters<=1 ? 999. : atan2(sin(PhiPshwSub2-PhiSeed),cos(PhiPshwSub2-PhiSeed)));
3357  vals[62] = EPshwSub3/SCRawEnergy;
3358  vals[63] = (NPshwClusters<=2 ? 999. : EtaPshwSub3-EtaSeed);
3359  vals[64] = (NPshwClusters<=2 ? 999. : atan2(sin(PhiPshwSub3-PhiSeed),cos(PhiPshwSub3-PhiSeed)));
3360 
3361  }
3362 
3363  // Now evaluating the regression
3364  double regressionResult = 0;
3365  Int_t BinIndex = -1;
3366 
3367  if (fVersionType == kWithSubCluVar) {
3368  if (isEB) {
3369  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
3370  BinIndex = 0;
3371  }
3372  else {
3373  regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
3374  BinIndex = 1;
3375  }
3376  }
3377 
3378  //print debug
3379  if (printDebug) {
3380  if (isEB) {
3381  std::cout << "Barrel :";
3382  for (unsigned int v=0; v < 61; ++v) std::cout << v << "=" << vals[v] << ", ";
3383  std::cout << "\n";
3384  }
3385  else {
3386  std::cout << "Endcap :";
3387  for (unsigned int v=0; v < 65; ++v) std::cout << v << "=" << vals[v] << ", ";
3388  std::cout << "\n";
3389  }
3390  std::cout << "BinIndex : " << BinIndex << "\n";
3391  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3392  std::cout << "regression energy = " << regressionResult << std::endl;
3393  }
3394 
3395 
3396  // Cleaning up and returning
3397  delete[] vals;
3398  return regressionResult;
3399 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVar ( double  electronP,
double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  pt,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
bool  printDebug = false 
)

Definition at line 1271 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVar, RecoTauCleanerPlugins::pt, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

1313 {
1314  // Checking if instance has been initialized
1315  if (fIsInitialized == kFALSE) {
1316  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1317  return 0;
1318  }
1319 
1320  // Checking if fVersionType is correct
1321  assert(fVersionType == kWithTrkVar);
1322 
1323  float *vals = (fabs(scEta) <= 1.479) ? new float[43] : new float[36];
1324  if (fabs(scEta) <= 1.479) { // Barrel
1325  vals[0] = SCRawEnergy;
1326  vals[1] = scEta;
1327  vals[2] = scPhi;
1328  vals[3] = R9;
1329  vals[4] = E5x5Seed/SCRawEnergy;
1330  vals[5] = etawidth;
1331  vals[6] = phiwidth;
1332  vals[7] = NClusters;
1333  vals[8] = HoE;
1334  vals[9] = rho;
1335  vals[10] = vertices;
1336  vals[11] = EtaSeed - scEta;
1337  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1338  vals[13] = ESeed/SCRawEnergy;
1339  vals[14] = E3x3Seed/ESeed;
1340  vals[15] = E5x5Seed/ESeed;
1341  vals[16] = see;
1342  vals[17] = spp;
1343  vals[18] = sep;
1344  vals[19] = EMaxSeed/ESeed;
1345  vals[20] = E2ndSeed/ESeed;
1346  vals[21] = ETopSeed/ESeed;
1347  vals[22] = EBottomSeed/ESeed;
1348  vals[23] = ELeftSeed/ESeed;
1349  vals[24] = ERightSeed/ESeed;
1350  vals[25] = E2x5MaxSeed/ESeed;
1351  vals[26] = E2x5TopSeed/ESeed;
1352  vals[27] = E2x5BottomSeed/ESeed;
1353  vals[28] = E2x5LeftSeed/ESeed;
1354  vals[29] = E2x5RightSeed/ESeed;
1355  vals[30] = pt;
1356  vals[31] = GsfTrackPIn;
1357  vals[32] = fbrem;
1358  vals[33] = Charge;
1359  vals[34] = EoP;
1360  vals[35] = IEtaSeed;
1361  vals[36] = IPhiSeed;
1362  vals[37] = ((int) IEtaSeed)%5;
1363  vals[38] = ((int) IPhiSeed)%2;
1364  vals[39] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1365  vals[40] = ((int) IPhiSeed)%20;
1366  vals[41] = EtaCrySeed;
1367  vals[42] = PhiCrySeed;
1368  }
1369 
1370  else { // Endcap
1371  vals[0] = SCRawEnergy;
1372  vals[1] = scEta;
1373  vals[2] = scPhi;
1374  vals[3] = R9;
1375  vals[4] = E5x5Seed/SCRawEnergy;
1376  vals[5] = etawidth;
1377  vals[6] = phiwidth;
1378  vals[7] = NClusters;
1379  vals[8] = HoE;
1380  vals[9] = rho;
1381  vals[10] = vertices;
1382  vals[11] = EtaSeed - scEta;
1383  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1384  vals[13] = ESeed/SCRawEnergy;
1385  vals[14] = E3x3Seed/ESeed;
1386  vals[15] = E5x5Seed/ESeed;
1387  vals[16] = see;
1388  vals[17] = spp;
1389  vals[18] = sep;
1390  vals[19] = EMaxSeed/ESeed;
1391  vals[20] = E2ndSeed/ESeed;
1392  vals[21] = ETopSeed/ESeed;
1393  vals[22] = EBottomSeed/ESeed;
1394  vals[23] = ELeftSeed/ESeed;
1395  vals[24] = ERightSeed/ESeed;
1396  vals[25] = E2x5MaxSeed/ESeed;
1397  vals[26] = E2x5TopSeed/ESeed;
1398  vals[27] = E2x5BottomSeed/ESeed;
1399  vals[28] = E2x5LeftSeed/ESeed;
1400  vals[29] = E2x5RightSeed/ESeed;
1401  vals[30] = pt;
1402  vals[31] = GsfTrackPIn;
1403  vals[32] = fbrem;
1404  vals[33] = Charge;
1405  vals[34] = EoP;
1406  vals[35] = PreShowerOverRaw;
1407  }
1408 
1409  // Now evaluating the regression
1410  double regressionResult = 0;
1411 
1412  if (fVersionType == kWithTrkVar) {
1413  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1414  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1415  }
1416 
1417 
1418  //print debug
1419  if (printDebug) {
1420  if (scEta <= 1.479) {
1421  std::cout << "Barrel :";
1422  for (unsigned int v=0; v < 43; ++v) std::cout << vals[v] << ", ";
1423  std::cout << "\n";
1424  }
1425  else {
1426  std::cout << "Endcap :";
1427  for (unsigned int v=0; v < 36; ++v) std::cout << vals[v] << ", ";
1428  std::cout << "\n";
1429  }
1430  std::cout << "pt = " << pt << " : SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1431  std::cout << "regression energy = " << regressionResult << std::endl;
1432  }
1433 
1434  // Cleaning up and returning
1435  delete[] vals;
1436  return regressionResult;
1437 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV1 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  TrackMomentumError,
double  EcalEnergyError,
int  Classification,
bool  printDebug = false 
)

Definition at line 1615 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergy().

1659 {
1660  // Checking if instance has been initialized
1661  if (fIsInitialized == kFALSE) {
1662  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1663  return 0;
1664  }
1665 
1666  // Checking if fVersionType is correct
1667  assert(fVersionType == kWithTrkVarV1);
1668 
1669  float *vals = (fabs(scEta) <= 1.479) ? new float[46] : new float[39];
1670  if (fabs(scEta) <= 1.479) { // Barrel
1671  vals[0] = SCRawEnergy;
1672  vals[1] = scEta;
1673  vals[2] = scPhi;
1674  vals[3] = R9;
1675  vals[4] = E5x5Seed/SCRawEnergy;
1676  vals[5] = etawidth;
1677  vals[6] = phiwidth;
1678  vals[7] = NClusters;
1679  vals[8] = HoE;
1680  vals[9] = rho;
1681  vals[10] = vertices;
1682  vals[11] = EtaSeed - scEta;
1683  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1684  vals[13] = ESeed/SCRawEnergy;
1685  vals[14] = E3x3Seed/ESeed;
1686  vals[15] = E5x5Seed/ESeed;
1687  vals[16] = see;
1688  vals[17] = spp;
1689  vals[18] = sep;
1690  vals[19] = EMaxSeed/ESeed;
1691  vals[20] = E2ndSeed/ESeed;
1692  vals[21] = ETopSeed/ESeed;
1693  vals[22] = EBottomSeed/ESeed;
1694  vals[23] = ELeftSeed/ESeed;
1695  vals[24] = ERightSeed/ESeed;
1696  vals[25] = E2x5MaxSeed/ESeed;
1697  vals[26] = E2x5TopSeed/ESeed;
1698  vals[27] = E2x5BottomSeed/ESeed;
1699  vals[28] = E2x5LeftSeed/ESeed;
1700  vals[29] = E2x5RightSeed/ESeed;
1701  vals[30] = IsEcalDriven;
1702  vals[31] = GsfTrackPIn;
1703  vals[32] = fbrem;
1704  vals[33] = Charge;
1705  vals[34] = EoP;
1706  vals[35] = TrackMomentumError/GsfTrackPIn;
1707  vals[36] = EcalEnergyError/SCRawEnergy;
1708  vals[37] = Classification;
1709  vals[38] = IEtaSeed;
1710  vals[39] = IPhiSeed;
1711  vals[40] = ((int) IEtaSeed)%5;
1712  vals[41] = ((int) IPhiSeed)%2;
1713  vals[42] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
1714  vals[43] = ((int) IPhiSeed)%20;
1715  vals[44] = EtaCrySeed;
1716  vals[45] = PhiCrySeed;
1717  }
1718 
1719  else { // Endcap
1720  vals[0] = SCRawEnergy;
1721  vals[1] = scEta;
1722  vals[2] = scPhi;
1723  vals[3] = R9;
1724  vals[4] = E5x5Seed/SCRawEnergy;
1725  vals[5] = etawidth;
1726  vals[6] = phiwidth;
1727  vals[7] = NClusters;
1728  vals[8] = HoE;
1729  vals[9] = rho;
1730  vals[10] = vertices;
1731  vals[11] = EtaSeed - scEta;
1732  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
1733  vals[13] = ESeed/SCRawEnergy;
1734  vals[14] = E3x3Seed/ESeed;
1735  vals[15] = E5x5Seed/ESeed;
1736  vals[16] = see;
1737  vals[17] = spp;
1738  vals[18] = sep;
1739  vals[19] = EMaxSeed/ESeed;
1740  vals[20] = E2ndSeed/ESeed;
1741  vals[21] = ETopSeed/ESeed;
1742  vals[22] = EBottomSeed/ESeed;
1743  vals[23] = ELeftSeed/ESeed;
1744  vals[24] = ERightSeed/ESeed;
1745  vals[25] = E2x5MaxSeed/ESeed;
1746  vals[26] = E2x5TopSeed/ESeed;
1747  vals[27] = E2x5BottomSeed/ESeed;
1748  vals[28] = E2x5LeftSeed/ESeed;
1749  vals[29] = E2x5RightSeed/ESeed;
1750  vals[30] = IsEcalDriven;
1751  vals[31] = GsfTrackPIn;
1752  vals[32] = fbrem;
1753  vals[33] = Charge;
1754  vals[34] = EoP;
1755  vals[35] = TrackMomentumError/GsfTrackPIn;
1756  vals[36] = EcalEnergyError/SCRawEnergy;
1757  vals[37] = Classification;
1758  vals[38] = PreShowerOverRaw;
1759  }
1760 
1761  // Now evaluating the regression
1762  double regressionResult = 0;
1763 
1764  if (fVersionType == kWithTrkVarV1) {
1765  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1766  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1767  }
1768 
1769 
1770  //print debug
1771  if (printDebug) {
1772  if (fabs(scEta) <= 1.479) {
1773  std::cout << "Barrel :";
1774  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
1775  std::cout << "\n";
1776  }
1777  else {
1778  std::cout << "Endcap :";
1779  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
1780  std::cout << "\n";
1781  }
1782  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1783  std::cout << "regression energy = " << regressionResult << std::endl;
1784  }
1785 
1786  // Cleaning up and returning
1787  delete[] vals;
1788  return regressionResult;
1789 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV1 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 1974 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

1976 {
1977  // Checking if instance has been initialized
1978  if (fIsInitialized == kFALSE) {
1979  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1980  return 0;
1981  }
1982 
1983  // Checking if fVersionType is correct
1984  assert(fVersionType == kWithTrkVarV1);
1985 
1986  // Checking if fVersionType is correct
1987  assert(inputvars.size() == 42);
1988 
1989  double SCRawEnergy = inputvars[0];
1990  double scEta = inputvars[1];
1991  double scPhi = inputvars[2];
1992  double R9 = inputvars[3];
1993  double etawidth = inputvars[4];
1994  double phiwidth = inputvars[5];
1995  double NClusters = inputvars[6];
1996  double HoE = inputvars[7];
1997  double rho = inputvars[8];
1998  double vertices = inputvars[9];
1999  double EtaSeed = inputvars[10];
2000  double PhiSeed = inputvars[11];
2001  double ESeed = inputvars[12];
2002  double E3x3Seed = inputvars[13];
2003  double E5x5Seed = inputvars[14];
2004  double see = inputvars[15];
2005  double spp = inputvars[16];
2006  double sep = inputvars[17];
2007  double EMaxSeed = inputvars[18];
2008  double E2ndSeed = inputvars[19];
2009  double ETopSeed = inputvars[20];
2010  double EBottomSeed = inputvars[21];
2011  double ELeftSeed = inputvars[22];
2012  double ERightSeed = inputvars[23];
2013  double E2x5MaxSeed = inputvars[24];
2014  double E2x5TopSeed = inputvars[25];
2015  double E2x5BottomSeed = inputvars[26];
2016  double E2x5LeftSeed = inputvars[27];
2017  double E2x5RightSeed = inputvars[28];
2018  double IEtaSeed = inputvars[29];
2019  double IPhiSeed = inputvars[30];
2020  double EtaCrySeed = inputvars[31];
2021  double PhiCrySeed = inputvars[32];
2022  double PreShowerOverRaw = inputvars[33];
2023  int IsEcalDriven = inputvars[34];
2024  double GsfTrackPIn = inputvars[35];
2025  double fbrem = inputvars[36];
2026  double Charge = inputvars[37];
2027  double EoP = inputvars[38];
2028  double TrackMomentumError = inputvars[39];
2029  double EcalEnergyError = inputvars[40];
2030  int Classification = inputvars[41];
2031 
2032  float *vals = (fabs(scEta) <= 1.479) ? new float[46] : new float[39];
2033  if (fabs(scEta) <= 1.479) { // Barrel
2034  vals[0] = SCRawEnergy;
2035  vals[1] = scEta;
2036  vals[2] = scPhi;
2037  vals[3] = R9;
2038  vals[4] = E5x5Seed/SCRawEnergy;
2039  vals[5] = etawidth;
2040  vals[6] = phiwidth;
2041  vals[7] = NClusters;
2042  vals[8] = HoE;
2043  vals[9] = rho;
2044  vals[10] = vertices;
2045  vals[11] = EtaSeed - scEta;
2046  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2047  vals[13] = ESeed/SCRawEnergy;
2048  vals[14] = E3x3Seed/ESeed;
2049  vals[15] = E5x5Seed/ESeed;
2050  vals[16] = see;
2051  vals[17] = spp;
2052  vals[18] = sep;
2053  vals[19] = EMaxSeed/ESeed;
2054  vals[20] = E2ndSeed/ESeed;
2055  vals[21] = ETopSeed/ESeed;
2056  vals[22] = EBottomSeed/ESeed;
2057  vals[23] = ELeftSeed/ESeed;
2058  vals[24] = ERightSeed/ESeed;
2059  vals[25] = E2x5MaxSeed/ESeed;
2060  vals[26] = E2x5TopSeed/ESeed;
2061  vals[27] = E2x5BottomSeed/ESeed;
2062  vals[28] = E2x5LeftSeed/ESeed;
2063  vals[29] = E2x5RightSeed/ESeed;
2064  vals[30] = IsEcalDriven;
2065  vals[31] = GsfTrackPIn;
2066  vals[32] = fbrem;
2067  vals[33] = Charge;
2068  vals[34] = EoP;
2069  vals[35] = TrackMomentumError/GsfTrackPIn;
2070  vals[36] = EcalEnergyError/SCRawEnergy;
2071  vals[37] = Classification;
2072  vals[38] = IEtaSeed;
2073  vals[39] = IPhiSeed;
2074  vals[40] = ((int) IEtaSeed)%5;
2075  vals[41] = ((int) IPhiSeed)%2;
2076  vals[42] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
2077  vals[43] = ((int) IPhiSeed)%20;
2078  vals[44] = EtaCrySeed;
2079  vals[45] = PhiCrySeed;
2080  }
2081 
2082  else { // Endcap
2083  vals[0] = SCRawEnergy;
2084  vals[1] = scEta;
2085  vals[2] = scPhi;
2086  vals[3] = R9;
2087  vals[4] = E5x5Seed/SCRawEnergy;
2088  vals[5] = etawidth;
2089  vals[6] = phiwidth;
2090  vals[7] = NClusters;
2091  vals[8] = HoE;
2092  vals[9] = rho;
2093  vals[10] = vertices;
2094  vals[11] = EtaSeed - scEta;
2095  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2096  vals[13] = ESeed/SCRawEnergy;
2097  vals[14] = E3x3Seed/ESeed;
2098  vals[15] = E5x5Seed/ESeed;
2099  vals[16] = see;
2100  vals[17] = spp;
2101  vals[18] = sep;
2102  vals[19] = EMaxSeed/ESeed;
2103  vals[20] = E2ndSeed/ESeed;
2104  vals[21] = ETopSeed/ESeed;
2105  vals[22] = EBottomSeed/ESeed;
2106  vals[23] = ELeftSeed/ESeed;
2107  vals[24] = ERightSeed/ESeed;
2108  vals[25] = E2x5MaxSeed/ESeed;
2109  vals[26] = E2x5TopSeed/ESeed;
2110  vals[27] = E2x5BottomSeed/ESeed;
2111  vals[28] = E2x5LeftSeed/ESeed;
2112  vals[29] = E2x5RightSeed/ESeed;
2113  vals[30] = IsEcalDriven;
2114  vals[31] = GsfTrackPIn;
2115  vals[32] = fbrem;
2116  vals[33] = Charge;
2117  vals[34] = EoP;
2118  vals[35] = TrackMomentumError/GsfTrackPIn;
2119  vals[36] = EcalEnergyError/SCRawEnergy;
2120  vals[37] = Classification;
2121  vals[38] = PreShowerOverRaw;
2122  }
2123 
2124  // Now evaluating the regression
2125  double regressionResult = 0;
2126 
2127  if (fVersionType == kWithTrkVarV1) {
2128  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2129  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2130  }
2131 
2132 
2133  //print debug
2134  if (printDebug) {
2135  if (fabs(scEta) <= 1.479) {
2136  std::cout << "Barrel :";
2137  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
2138  std::cout << "\n";
2139  }
2140  else {
2141  std::cout << "Endcap :";
2142  for (unsigned int v=0; v < 39; ++v) std::cout << vals[v] << ", ";
2143  std::cout << "\n";
2144  }
2145  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2146  std::cout << "regression energy = " << regressionResult << std::endl;
2147  }
2148 
2149  // Cleaning up and returning
2150  delete[] vals;
2151  return regressionResult;
2152 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV2 ( double  SCRawEnergy,
double  scEta,
double  scPhi,
double  R9,
double  etawidth,
double  phiwidth,
double  NClusters,
double  HoE,
double  rho,
double  vertices,
double  EtaSeed,
double  PhiSeed,
double  ESeed,
double  E3x3Seed,
double  E5x5Seed,
double  see,
double  spp,
double  sep,
double  EMaxSeed,
double  E2ndSeed,
double  ETopSeed,
double  EBottomSeed,
double  ELeftSeed,
double  ERightSeed,
double  E2x5MaxSeed,
double  E2x5TopSeed,
double  E2x5BottomSeed,
double  E2x5LeftSeed,
double  E2x5RightSeed,
double  IEtaSeed,
double  IPhiSeed,
double  EtaCrySeed,
double  PhiCrySeed,
double  PreShowerOverRaw,
int  IsEcalDriven,
double  GsfTrackPIn,
double  fbrem,
double  Charge,
double  EoP,
double  TrackMomentumError,
double  EcalEnergyError,
int  Classification,
double  detaIn,
double  dphiIn,
double  detaCalo,
double  dphiCalo,
double  GsfTrackChiSqr,
double  KFTrackNLayers,
double  ElectronEnergyOverPout,
bool  printDebug = false 
)

Definition at line 2340 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

Referenced by calculateRegressionEnergy().

2391 {
2392  // Checking if instance has been initialized
2393  if (fIsInitialized == kFALSE) {
2394  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2395  return 0;
2396  }
2397 
2398  // Checking if fVersionType is correct
2399  assert(fVersionType == kWithTrkVarV2);
2400 
2401  float *vals = (fabs(scEta) <= 1.479) ? new float[53] : new float[46];
2402  if (fabs(scEta) <= 1.479) { // Barrel
2403  vals[0] = SCRawEnergy;
2404  vals[1] = scEta;
2405  vals[2] = scPhi;
2406  vals[3] = R9;
2407  vals[4] = E5x5Seed/SCRawEnergy;
2408  vals[5] = etawidth;
2409  vals[6] = phiwidth;
2410  vals[7] = NClusters;
2411  vals[8] = HoE;
2412  vals[9] = rho;
2413  vals[10] = vertices;
2414  vals[11] = EtaSeed - scEta;
2415  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2416  vals[13] = ESeed/SCRawEnergy;
2417  vals[14] = E3x3Seed/ESeed;
2418  vals[15] = E5x5Seed/ESeed;
2419  vals[16] = see;
2420  vals[17] = spp;
2421  vals[18] = sep;
2422  vals[19] = EMaxSeed/ESeed;
2423  vals[20] = E2ndSeed/ESeed;
2424  vals[21] = ETopSeed/ESeed;
2425  vals[22] = EBottomSeed/ESeed;
2426  vals[23] = ELeftSeed/ESeed;
2427  vals[24] = ERightSeed/ESeed;
2428  vals[25] = E2x5MaxSeed/ESeed;
2429  vals[26] = E2x5TopSeed/ESeed;
2430  vals[27] = E2x5BottomSeed/ESeed;
2431  vals[28] = E2x5LeftSeed/ESeed;
2432  vals[29] = E2x5RightSeed/ESeed;
2433  vals[30] = IsEcalDriven;
2434  vals[31] = GsfTrackPIn;
2435  vals[32] = fbrem;
2436  vals[33] = Charge;
2437  vals[34] = EoP;
2438  vals[35] = TrackMomentumError/GsfTrackPIn;
2439  vals[36] = EcalEnergyError/SCRawEnergy;
2440  vals[37] = Classification;
2441  vals[38] = detaIn;
2442  vals[39] = dphiIn;
2443  vals[40] = detaCalo;
2444  vals[41] = dphiCalo;
2445  vals[42] = GsfTrackChiSqr;
2446  vals[43] = KFTrackNLayers;
2447  vals[44] = ElectronEnergyOverPout;
2448  vals[45] = IEtaSeed;
2449  vals[46] = IPhiSeed;
2450  vals[47] = ((int) IEtaSeed)%5;
2451  vals[48] = ((int) IPhiSeed)%2;
2452  vals[49] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
2453  vals[50] = ((int) IPhiSeed)%20;
2454  vals[51] = EtaCrySeed;
2455  vals[52] = PhiCrySeed;
2456  }
2457 
2458  else { // Endcap
2459  vals[0] = SCRawEnergy;
2460  vals[1] = scEta;
2461  vals[2] = scPhi;
2462  vals[3] = R9;
2463  vals[4] = E5x5Seed/SCRawEnergy;
2464  vals[5] = etawidth;
2465  vals[6] = phiwidth;
2466  vals[7] = NClusters;
2467  vals[8] = HoE;
2468  vals[9] = rho;
2469  vals[10] = vertices;
2470  vals[11] = EtaSeed - scEta;
2471  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2472  vals[13] = ESeed/SCRawEnergy;
2473  vals[14] = E3x3Seed/ESeed;
2474  vals[15] = E5x5Seed/ESeed;
2475  vals[16] = see;
2476  vals[17] = spp;
2477  vals[18] = sep;
2478  vals[19] = EMaxSeed/ESeed;
2479  vals[20] = E2ndSeed/ESeed;
2480  vals[21] = ETopSeed/ESeed;
2481  vals[22] = EBottomSeed/ESeed;
2482  vals[23] = ELeftSeed/ESeed;
2483  vals[24] = ERightSeed/ESeed;
2484  vals[25] = E2x5MaxSeed/ESeed;
2485  vals[26] = E2x5TopSeed/ESeed;
2486  vals[27] = E2x5BottomSeed/ESeed;
2487  vals[28] = E2x5LeftSeed/ESeed;
2488  vals[29] = E2x5RightSeed/ESeed;
2489  vals[30] = IsEcalDriven;
2490  vals[31] = GsfTrackPIn;
2491  vals[32] = fbrem;
2492  vals[33] = Charge;
2493  vals[34] = EoP;
2494  vals[35] = TrackMomentumError/GsfTrackPIn;
2495  vals[36] = EcalEnergyError/SCRawEnergy;
2496  vals[37] = Classification;
2497  vals[38] = detaIn;
2498  vals[39] = dphiIn;
2499  vals[40] = detaCalo;
2500  vals[41] = dphiCalo;
2501  vals[42] = GsfTrackChiSqr;
2502  vals[43] = KFTrackNLayers;
2503  vals[44] = ElectronEnergyOverPout;
2504  vals[45] = PreShowerOverRaw;
2505  }
2506 
2507  // Now evaluating the regression
2508  double regressionResult = 0;
2509 
2510  if (fVersionType == kWithTrkVarV2) {
2511  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2512  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2513  }
2514 
2515 
2516  //print debug
2517  if (printDebug) {
2518  if (fabs(scEta) <= 1.479) {
2519  std::cout << "Barrel :";
2520  for (unsigned int v=0; v < 53; ++v) std::cout << vals[v] << ", ";
2521  std::cout << "\n";
2522  }
2523  else {
2524  std::cout << "Endcap :";
2525  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
2526  std::cout << "\n";
2527  }
2528  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2529  std::cout << "regression energy = " << regressionResult << std::endl;
2530  }
2531 
2532  // Cleaning up and returning
2533  delete[] vals;
2534  return regressionResult;
2535 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV2 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2740 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and create_public_pileup_plots::vals.

2742 {
2743  // Checking if instance has been initialized
2744  if (fIsInitialized == kFALSE) {
2745  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2746  return 0;
2747  }
2748 
2749  // Checking if fVersionType is correct
2750  assert(fVersionType == kWithTrkVarV2);
2751 
2752  // Checking if fVersionType is correct
2753  assert(inputvars.size() == 49);
2754 
2755  double SCRawEnergy = inputvars[0];
2756  double scEta = inputvars[1];
2757  double scPhi = inputvars[2];
2758  double R9 = inputvars[3];
2759  double etawidth = inputvars[4];
2760  double phiwidth = inputvars[5];
2761  double NClusters = inputvars[6];
2762  double HoE = inputvars[7];
2763  double rho = inputvars[8];
2764  double vertices = inputvars[9];
2765  double EtaSeed = inputvars[10];
2766  double PhiSeed = inputvars[11];
2767  double ESeed = inputvars[12];
2768  double E3x3Seed = inputvars[13];
2769  double E5x5Seed = inputvars[14];
2770  double see = inputvars[15];
2771  double spp = inputvars[16];
2772  double sep = inputvars[17];
2773  double EMaxSeed = inputvars[18];
2774  double E2ndSeed = inputvars[19];
2775  double ETopSeed = inputvars[20];
2776  double EBottomSeed = inputvars[21];
2777  double ELeftSeed = inputvars[22];
2778  double ERightSeed = inputvars[23];
2779  double E2x5MaxSeed = inputvars[24];
2780  double E2x5TopSeed = inputvars[25];
2781  double E2x5BottomSeed = inputvars[26];
2782  double E2x5LeftSeed = inputvars[27];
2783  double E2x5RightSeed = inputvars[28];
2784  double IEtaSeed = inputvars[29];
2785  double IPhiSeed = inputvars[30];
2786  double EtaCrySeed = inputvars[31];
2787  double PhiCrySeed = inputvars[32];
2788  double PreShowerOverRaw = inputvars[33];
2789  int IsEcalDriven = inputvars[34];
2790  double GsfTrackPIn = inputvars[35];
2791  double fbrem = inputvars[36];
2792  double Charge = inputvars[37];
2793  double EoP = inputvars[38];
2794  double TrackMomentumError = inputvars[39];
2795  double EcalEnergyError = inputvars[40];
2796  int Classification = inputvars[41];
2797  double detaIn = inputvars[42];
2798  double dphiIn = inputvars[43];
2799  double detaCalo = inputvars[44];
2800  double dphiCalo = inputvars[45];
2801  double GsfTrackChiSqr = inputvars[46];
2802  double KFTrackNLayers = inputvars[47];
2803  double ElectronEnergyOverPout = inputvars[48];
2804 
2805  float *vals = (fabs(scEta) <= 1.479) ? new float[53] : new float[46];
2806  if (fabs(scEta) <= 1.479) { // Barrel
2807  vals[0] = SCRawEnergy;
2808  vals[1] = scEta;
2809  vals[2] = scPhi;
2810  vals[3] = R9;
2811  vals[4] = E5x5Seed/SCRawEnergy;
2812  vals[5] = etawidth;
2813  vals[6] = phiwidth;
2814  vals[7] = NClusters;
2815  vals[8] = HoE;
2816  vals[9] = rho;
2817  vals[10] = vertices;
2818  vals[11] = EtaSeed - scEta;
2819  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2820  vals[13] = ESeed/SCRawEnergy;
2821  vals[14] = E3x3Seed/ESeed;
2822  vals[15] = E5x5Seed/ESeed;
2823  vals[16] = see;
2824  vals[17] = spp;
2825  vals[18] = sep;
2826  vals[19] = EMaxSeed/ESeed;
2827  vals[20] = E2ndSeed/ESeed;
2828  vals[21] = ETopSeed/ESeed;
2829  vals[22] = EBottomSeed/ESeed;
2830  vals[23] = ELeftSeed/ESeed;
2831  vals[24] = ERightSeed/ESeed;
2832  vals[25] = E2x5MaxSeed/ESeed;
2833  vals[26] = E2x5TopSeed/ESeed;
2834  vals[27] = E2x5BottomSeed/ESeed;
2835  vals[28] = E2x5LeftSeed/ESeed;
2836  vals[29] = E2x5RightSeed/ESeed;
2837  vals[30] = IsEcalDriven;
2838  vals[31] = GsfTrackPIn;
2839  vals[32] = fbrem;
2840  vals[33] = Charge;
2841  vals[34] = EoP;
2842  vals[35] = TrackMomentumError/GsfTrackPIn;
2843  vals[36] = EcalEnergyError/SCRawEnergy;
2844  vals[37] = Classification;
2845  vals[38] = detaIn;
2846  vals[39] = dphiIn;
2847  vals[40] = detaCalo;
2848  vals[41] = dphiCalo;
2849  vals[42] = GsfTrackChiSqr;
2850  vals[43] = KFTrackNLayers;
2851  vals[44] = ElectronEnergyOverPout;
2852  vals[45] = IEtaSeed;
2853  vals[46] = IPhiSeed;
2854  vals[47] = ((int) IEtaSeed)%5;
2855  vals[48] = ((int) IPhiSeed)%2;
2856  vals[49] = (abs(IEtaSeed)<=25)*(((int)IEtaSeed)%25) + (abs(IEtaSeed)>25)*(((int) (IEtaSeed-25*abs(IEtaSeed)/IEtaSeed))%20);
2857  vals[50] = ((int) IPhiSeed)%20;
2858  vals[51] = EtaCrySeed;
2859  vals[52] = PhiCrySeed;
2860  }
2861 
2862  else { // Endcap
2863  vals[0] = SCRawEnergy;
2864  vals[1] = scEta;
2865  vals[2] = scPhi;
2866  vals[3] = R9;
2867  vals[4] = E5x5Seed/SCRawEnergy;
2868  vals[5] = etawidth;
2869  vals[6] = phiwidth;
2870  vals[7] = NClusters;
2871  vals[8] = HoE;
2872  vals[9] = rho;
2873  vals[10] = vertices;
2874  vals[11] = EtaSeed - scEta;
2875  vals[12] = atan2(sin(PhiSeed-scPhi),cos(PhiSeed-scPhi));
2876  vals[13] = ESeed/SCRawEnergy;
2877  vals[14] = E3x3Seed/ESeed;
2878  vals[15] = E5x5Seed/ESeed;
2879  vals[16] = see;
2880  vals[17] = spp;
2881  vals[18] = sep;
2882  vals[19] = EMaxSeed/ESeed;
2883  vals[20] = E2ndSeed/ESeed;
2884  vals[21] = ETopSeed/ESeed;
2885  vals[22] = EBottomSeed/ESeed;
2886  vals[23] = ELeftSeed/ESeed;
2887  vals[24] = ERightSeed/ESeed;
2888  vals[25] = E2x5MaxSeed/ESeed;
2889  vals[26] = E2x5TopSeed/ESeed;
2890  vals[27] = E2x5BottomSeed/ESeed;
2891  vals[28] = E2x5LeftSeed/ESeed;
2892  vals[29] = E2x5RightSeed/ESeed;
2893  vals[30] = IsEcalDriven;
2894  vals[31] = GsfTrackPIn;
2895  vals[32] = fbrem;
2896  vals[33] = Charge;
2897  vals[34] = EoP;
2898  vals[35] = TrackMomentumError/GsfTrackPIn;
2899  vals[36] = EcalEnergyError/SCRawEnergy;
2900  vals[37] = Classification;
2901  vals[38] = detaIn;
2902  vals[39] = dphiIn;
2903  vals[40] = detaCalo;
2904  vals[41] = dphiCalo;
2905  vals[42] = GsfTrackChiSqr;
2906  vals[43] = KFTrackNLayers;
2907  vals[44] = ElectronEnergyOverPout;
2908  vals[45] = PreShowerOverRaw;
2909  }
2910 
2911  // Now evaluating the regression
2912  double regressionResult = 0;
2913 
2914  if (fVersionType == kWithTrkVarV2) {
2915  if (fabs(scEta) <= 1.479) regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2916  else regressionResult = (SCRawEnergy*(1+PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2917  }
2918 
2919 
2920  //print debug
2921  if (printDebug) {
2922  if (fabs(scEta) <= 1.479) {
2923  std::cout << "Barrel :";
2924  for (unsigned int v=0; v < 53; ++v) std::cout << vals[v] << ", ";
2925  std::cout << "\n";
2926  }
2927  else {
2928  std::cout << "Endcap :";
2929  for (unsigned int v=0; v < 46; ++v) std::cout << vals[v] << ", ";
2930  std::cout << "\n";
2931  }
2932  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2933  std::cout << "regression energy = " << regressionResult << std::endl;
2934  }
2935 
2936  // Cleaning up and returning
2937  delete[] vals;
2938  return regressionResult;
2939 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:51
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

bool ElectronEnergyRegressionEvaluate::fIsInitialized
private
GBRForest* ElectronEnergyRegressionEvaluate::forestCorrection_eb
private
GBRForest* ElectronEnergyRegressionEvaluate::forestCorrection_ee
private
GBRForest* ElectronEnergyRegressionEvaluate::forestUncertainty_eb
private
GBRForest* ElectronEnergyRegressionEvaluate::forestUncertainty_ee
private
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType ElectronEnergyRegressionEvaluate::fVersionType
private