CMS 3D CMS Logo

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 32 of file ElectronEnergyRegressionEvaluate.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 24 of file ElectronEnergyRegressionEvaluate.cc.

24 {}

Member Function Documentation

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

Definition at line 49 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), 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(), HLT_2018_cff::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().

Referenced by ElectronRegressionEnergyProducer::filter(), and isInitialized().

50  {
51  if (!fIsInitialized) {
52  std::cout << "Error: Electron Energy Regression has not been initialized yet. return 0. \n";
53  return 0;
54  }
55 
56  if (printDebug) {
57  std::cout << "Regression Type: " << fVersionType << std::endl;
58  std::cout << "Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n";
59  }
60 
61  if (fVersionType == kNoTrkVar) {
62  return regressionValueNoTrkVar(mySCHelper.rawEnergy(),
63  mySCHelper.eta(),
64  mySCHelper.phi(),
65  mySCHelper.r9(),
66  mySCHelper.etaWidth(),
67  mySCHelper.phiWidth(),
68  mySCHelper.clustersSize(),
69  mySCHelper.hadronicOverEm(),
70  rho,
71  nvertices,
72  mySCHelper.seedEta(),
73  mySCHelper.seedPhi(),
74  mySCHelper.seedEnergy(),
75  mySCHelper.e3x3(),
76  mySCHelper.e5x5(),
77  mySCHelper.sigmaIetaIeta(),
78  mySCHelper.spp(),
79  mySCHelper.sep(),
80  mySCHelper.eMax(),
81  mySCHelper.e2nd(),
82  mySCHelper.eTop(),
83  mySCHelper.eBottom(),
84  mySCHelper.eLeft(),
85  mySCHelper.eRight(),
86  mySCHelper.e2x5Max(),
87  mySCHelper.e2x5Top(),
88  mySCHelper.e2x5Bottom(),
89  mySCHelper.e2x5Left(),
90  mySCHelper.e2x5Right(),
91  mySCHelper.ietaSeed(),
92  mySCHelper.iphiSeed(),
93  mySCHelper.etaCrySeed(),
94  mySCHelper.phiCrySeed(),
95  mySCHelper.preshowerEnergyOverRaw(),
96  printDebug);
97  }
99  return regressionValueWithSubClusters(mySCHelper.rawEnergy(),
100  mySCHelper.eta(),
101  mySCHelper.phi(),
102  mySCHelper.r9(),
103  mySCHelper.etaWidth(),
104  mySCHelper.phiWidth(),
105  mySCHelper.clustersSize(),
106  mySCHelper.hadronicOverEm(),
107  rho,
108  nvertices,
109  mySCHelper.seedEta(),
110  mySCHelper.seedPhi(),
111  mySCHelper.seedEnergy(),
112  mySCHelper.e3x3(),
113  mySCHelper.e5x5(),
114  mySCHelper.sigmaIetaIeta(),
115  mySCHelper.spp(),
116  mySCHelper.sep(),
117  mySCHelper.eMax(),
118  mySCHelper.e2nd(),
119  mySCHelper.eTop(),
120  mySCHelper.eBottom(),
121  mySCHelper.eLeft(),
122  mySCHelper.eRight(),
123  mySCHelper.e2x5Max(),
124  mySCHelper.e2x5Top(),
125  mySCHelper.e2x5Bottom(),
126  mySCHelper.e2x5Left(),
127  mySCHelper.e2x5Right(),
128  mySCHelper.ietaSeed(),
129  mySCHelper.iphiSeed(),
130  mySCHelper.etaCrySeed(),
131  mySCHelper.phiCrySeed(),
132  mySCHelper.preshowerEnergyOverRaw(),
133  ele->ecalDrivenSeed(),
134  ele->isEBEtaGap(),
135  ele->isEBPhiGap(),
136  ele->isEEDeeGap(),
137  mySCHelper.eSubClusters(),
138  mySCHelper.subClusterEnergy(1),
139  mySCHelper.subClusterEta(1),
140  mySCHelper.subClusterPhi(1),
141  mySCHelper.subClusterEmax(1),
142  mySCHelper.subClusterE3x3(1),
143  mySCHelper.subClusterEnergy(2),
144  mySCHelper.subClusterEta(2),
145  mySCHelper.subClusterPhi(2),
146  mySCHelper.subClusterEmax(2),
147  mySCHelper.subClusterE3x3(2),
148  mySCHelper.subClusterEnergy(3),
149  mySCHelper.subClusterEta(3),
150  mySCHelper.subClusterPhi(3),
151  mySCHelper.subClusterEmax(3),
152  mySCHelper.subClusterE3x3(3),
153  mySCHelper.nPreshowerClusters(),
154  mySCHelper.eESClusters(),
155  mySCHelper.esClusterEnergy(0),
156  mySCHelper.esClusterEta(0),
157  mySCHelper.esClusterPhi(0),
158  mySCHelper.esClusterEnergy(1),
159  mySCHelper.esClusterEta(1),
160  mySCHelper.esClusterPhi(1),
161  mySCHelper.esClusterEnergy(2),
162  mySCHelper.esClusterEta(2),
163  mySCHelper.esClusterPhi(2),
164  ele->isEB(),
165  printDebug);
166  } else if (fVersionType == kNoTrkVarV1) {
167  return regressionValueNoTrkVarV1(mySCHelper.rawEnergy(),
168  mySCHelper.eta(),
169  mySCHelper.phi(),
170  mySCHelper.r9(),
171  mySCHelper.etaWidth(),
172  mySCHelper.phiWidth(),
173  mySCHelper.clustersSize(),
174  mySCHelper.hadronicOverEm(),
175  rho,
176  nvertices,
177  mySCHelper.seedEta(),
178  mySCHelper.seedPhi(),
179  mySCHelper.seedEnergy(),
180  mySCHelper.e3x3(),
181  mySCHelper.e5x5(),
182  mySCHelper.sigmaIetaIeta(),
183  mySCHelper.spp(),
184  mySCHelper.sep(),
185  mySCHelper.eMax(),
186  mySCHelper.e2nd(),
187  mySCHelper.eTop(),
188  mySCHelper.eBottom(),
189  mySCHelper.eLeft(),
190  mySCHelper.eRight(),
191  mySCHelper.e2x5Max(),
192  mySCHelper.e2x5Top(),
193  mySCHelper.e2x5Bottom(),
194  mySCHelper.e2x5Left(),
195  mySCHelper.e2x5Right(),
196  mySCHelper.ietaSeed(),
197  mySCHelper.iphiSeed(),
198  mySCHelper.etaCrySeed(),
199  mySCHelper.phiCrySeed(),
200  mySCHelper.preshowerEnergyOverRaw(),
201  ele->ecalDrivenSeed(),
202  printDebug);
203  } else if (fVersionType == kWithTrkVarV1) {
204  return regressionValueWithTrkVarV1(mySCHelper.rawEnergy(),
205  mySCHelper.eta(),
206  mySCHelper.phi(),
207  mySCHelper.r9(),
208  mySCHelper.etaWidth(),
209  mySCHelper.phiWidth(),
210  mySCHelper.clustersSize(),
211  mySCHelper.hadronicOverEm(),
212  rho,
213  nvertices,
214  mySCHelper.seedEta(),
215  mySCHelper.seedPhi(),
216  mySCHelper.seedEnergy(),
217  mySCHelper.e3x3(),
218  mySCHelper.e5x5(),
219  mySCHelper.sigmaIetaIeta(),
220  mySCHelper.spp(),
221  mySCHelper.sep(),
222  mySCHelper.eMax(),
223  mySCHelper.e2nd(),
224  mySCHelper.eTop(),
225  mySCHelper.eBottom(),
226  mySCHelper.eLeft(),
227  mySCHelper.eRight(),
228  mySCHelper.e2x5Max(),
229  mySCHelper.e2x5Top(),
230  mySCHelper.e2x5Bottom(),
231  mySCHelper.e2x5Left(),
232  mySCHelper.e2x5Right(),
233  mySCHelper.ietaSeed(),
234  mySCHelper.iphiSeed(),
235  mySCHelper.etaCrySeed(),
236  mySCHelper.phiCrySeed(),
237  mySCHelper.preshowerEnergyOverRaw(),
238  ele->ecalDrivenSeed(),
239  ele->trackMomentumAtVtx().R(),
240  fmax(ele->fbrem(), -1.0),
241  ele->charge(),
242  fmin(ele->eSuperClusterOverP(), 20.0),
243  ele->trackMomentumError(),
245  ele->classification(),
246  printDebug);
247  } else if (fVersionType == kWithTrkVarV2) {
249  mySCHelper.rawEnergy(),
250  mySCHelper.eta(),
251  mySCHelper.phi(),
252  mySCHelper.r9(),
253  mySCHelper.etaWidth(),
254  mySCHelper.phiWidth(),
255  mySCHelper.clustersSize(),
256  mySCHelper.hadronicOverEm(),
257  rho,
258  nvertices,
259  mySCHelper.seedEta(),
260  mySCHelper.seedPhi(),
261  mySCHelper.seedEnergy(),
262  mySCHelper.e3x3(),
263  mySCHelper.e5x5(),
264  mySCHelper.sigmaIetaIeta(),
265  mySCHelper.spp(),
266  mySCHelper.sep(),
267  mySCHelper.eMax(),
268  mySCHelper.e2nd(),
269  mySCHelper.eTop(),
270  mySCHelper.eBottom(),
271  mySCHelper.eLeft(),
272  mySCHelper.eRight(),
273  mySCHelper.e2x5Max(),
274  mySCHelper.e2x5Top(),
275  mySCHelper.e2x5Bottom(),
276  mySCHelper.e2x5Left(),
277  mySCHelper.e2x5Right(),
278  mySCHelper.ietaSeed(),
279  mySCHelper.iphiSeed(),
280  mySCHelper.etaCrySeed(),
281  mySCHelper.phiCrySeed(),
282  mySCHelper.preshowerEnergyOverRaw(),
283  ele->ecalDrivenSeed(),
284  ele->trackMomentumAtVtx().R(),
285  fmax(ele->fbrem(), -1.0),
286  ele->charge(),
287  fmin(ele->eSuperClusterOverP(), 20.0),
288  ele->trackMomentumError(),
290  ele->classification(),
291  fmin(std::abs(ele->deltaEtaSuperClusterTrackAtVtx()), 0.6),
295  ele->gsfTrack()->chi2() / ele->gsfTrack()->ndof(),
296  (ele->closestCtfTrackRef().isNonnull() ? ele->closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement()
297  : -1),
298  fmin(ele->eEleClusterOverPout(), 20.0),
299  printDebug);
300  } else {
301  std::cout << "Warning: Electron Regression Type " << fVersionType
302  << " is not supported. Reverting to default electron momentum.\n";
303  return ele->p();
304  }
305 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:180
float trackMomentumError() const
Definition: GsfElectron.h:800
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
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 eta() const final
momentum pseudorapidity
float eESClusters() const
float e2x5Max() const
bool isEBEtaGap() const
Definition: GsfElectron.h:333
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
float esClusterEnergy(unsigned i) const
float sigmaIetaIeta() const
float subClusterE3x3(unsigned i) const
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:268
double pt() const final
transverse momentum
int charge() const final
electric charge
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:726
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:336
float eBottom() const
bool isEB() const
Definition: GsfElectron.h:328
float e2x5Bottom() const
float esClusterEta(unsigned i) const
float etaWidth() const
float rawEnergy() const
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
float subClusterEnergy(unsigned i) const
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:229
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:228
float eLeft() const
float preshowerEnergyOverRaw() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float eRight() const
float eEleClusterOverPout() const
Definition: GsfElectron.h:224
float e2x5Top() const
float hadronicOverEm() const
float phiWidth() const
float subClusterEmax(unsigned i) const
double p() const final
magnitude of momentum vector
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
Classification classification() const
Definition: GsfElectron.h:722
float seedEta() const
float correctedEcalEnergyError() const
Definition: GsfElectron.h:799
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:226
bool isEBPhiGap() const
Definition: GsfElectron.h:334
float nPreshowerClusters() const
float seedPhi() const
float clustersSize() const
float subClusterEta(unsigned i) const
float seedEnergy() const
double phi() const final
momentum azimuthal angle
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)
bool ecalDrivenSeed() const
Definition: GsfElectron.h:158
double ElectronEnergyRegressionEvaluate::calculateRegressionEnergyUncertainty ( const reco::GsfElectron ele,
SuperClusterHelper mySCHelper,
double  rho,
double  nvertices,
bool  printDebug = false 
)

Definition at line 307 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), 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(), HLT_2018_cff::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().

Referenced by ElectronRegressionEnergyProducer::filter(), and isInitialized().

308  {
309  if (!fIsInitialized) {
310  std::cout << "Error: Electron Energy Regression has not been initialized yet. return 0. \n";
311  return 0;
312  }
313 
314  if (printDebug) {
315  std::cout << "Regression Type: " << fVersionType << std::endl;
316  std::cout << "Electron : " << ele->pt() << " " << ele->eta() << " " << ele->phi() << "\n";
317  }
318 
319  if (fVersionType == kNoTrkVar) {
320  return regressionUncertaintyNoTrkVar(mySCHelper.rawEnergy(),
321  mySCHelper.eta(),
322  mySCHelper.phi(),
323  mySCHelper.r9(),
324  mySCHelper.etaWidth(),
325  mySCHelper.phiWidth(),
326  mySCHelper.clustersSize(),
327  mySCHelper.hadronicOverEm(),
328  rho,
329  nvertices,
330  mySCHelper.seedEta(),
331  mySCHelper.seedPhi(),
332  mySCHelper.seedEnergy(),
333  mySCHelper.e3x3(),
334  mySCHelper.e5x5(),
335  mySCHelper.sigmaIetaIeta(),
336  mySCHelper.spp(),
337  mySCHelper.sep(),
338  mySCHelper.eMax(),
339  mySCHelper.e2nd(),
340  mySCHelper.eTop(),
341  mySCHelper.eBottom(),
342  mySCHelper.eLeft(),
343  mySCHelper.eRight(),
344  mySCHelper.e2x5Max(),
345  mySCHelper.e2x5Top(),
346  mySCHelper.e2x5Bottom(),
347  mySCHelper.e2x5Left(),
348  mySCHelper.e2x5Right(),
349  mySCHelper.ietaSeed(),
350  mySCHelper.iphiSeed(),
351  mySCHelper.etaCrySeed(),
352  mySCHelper.phiCrySeed(),
353  mySCHelper.preshowerEnergyOverRaw(),
354  printDebug);
355  }
356  if (fVersionType == kWithSubCluVar) {
358  mySCHelper.eta(),
359  mySCHelper.phi(),
360  mySCHelper.r9(),
361  mySCHelper.etaWidth(),
362  mySCHelper.phiWidth(),
363  mySCHelper.clustersSize(),
364  mySCHelper.hadronicOverEm(),
365  rho,
366  nvertices,
367  mySCHelper.seedEta(),
368  mySCHelper.seedPhi(),
369  mySCHelper.seedEnergy(),
370  mySCHelper.e3x3(),
371  mySCHelper.e5x5(),
372  mySCHelper.sigmaIetaIeta(),
373  mySCHelper.spp(),
374  mySCHelper.sep(),
375  mySCHelper.eMax(),
376  mySCHelper.e2nd(),
377  mySCHelper.eTop(),
378  mySCHelper.eBottom(),
379  mySCHelper.eLeft(),
380  mySCHelper.eRight(),
381  mySCHelper.e2x5Max(),
382  mySCHelper.e2x5Top(),
383  mySCHelper.e2x5Bottom(),
384  mySCHelper.e2x5Left(),
385  mySCHelper.e2x5Right(),
386  mySCHelper.ietaSeed(),
387  mySCHelper.iphiSeed(),
388  mySCHelper.etaCrySeed(),
389  mySCHelper.phiCrySeed(),
390  mySCHelper.preshowerEnergyOverRaw(),
391  ele->ecalDrivenSeed(),
392  ele->isEBEtaGap(),
393  ele->isEBPhiGap(),
394  ele->isEEDeeGap(),
395  mySCHelper.eSubClusters(),
396  mySCHelper.subClusterEnergy(1),
397  mySCHelper.subClusterEta(1),
398  mySCHelper.subClusterPhi(1),
399  mySCHelper.subClusterEmax(1),
400  mySCHelper.subClusterE3x3(1),
401  mySCHelper.subClusterEnergy(2),
402  mySCHelper.subClusterEta(2),
403  mySCHelper.subClusterPhi(2),
404  mySCHelper.subClusterEmax(2),
405  mySCHelper.subClusterE3x3(2),
406  mySCHelper.subClusterEnergy(3),
407  mySCHelper.subClusterEta(3),
408  mySCHelper.subClusterPhi(3),
409  mySCHelper.subClusterEmax(3),
410  mySCHelper.subClusterE3x3(3),
411  mySCHelper.nPreshowerClusters(),
412  mySCHelper.eESClusters(),
413  mySCHelper.esClusterEnergy(0),
414  mySCHelper.esClusterEta(0),
415  mySCHelper.esClusterPhi(0),
416  mySCHelper.esClusterEnergy(1),
417  mySCHelper.esClusterEta(1),
418  mySCHelper.esClusterPhi(1),
419  mySCHelper.esClusterEnergy(2),
420  mySCHelper.esClusterEta(2),
421  mySCHelper.esClusterPhi(2),
422  ele->isEB(),
423  printDebug);
424  } else if (fVersionType == kNoTrkVarV1) {
425  return regressionUncertaintyNoTrkVarV1(mySCHelper.rawEnergy(),
426  mySCHelper.eta(),
427  mySCHelper.phi(),
428  mySCHelper.r9(),
429  mySCHelper.etaWidth(),
430  mySCHelper.phiWidth(),
431  mySCHelper.clustersSize(),
432  mySCHelper.hadronicOverEm(),
433  rho,
434  nvertices,
435  mySCHelper.seedEta(),
436  mySCHelper.seedPhi(),
437  mySCHelper.seedEnergy(),
438  mySCHelper.e3x3(),
439  mySCHelper.e5x5(),
440  mySCHelper.sigmaIetaIeta(),
441  mySCHelper.spp(),
442  mySCHelper.sep(),
443  mySCHelper.eMax(),
444  mySCHelper.e2nd(),
445  mySCHelper.eTop(),
446  mySCHelper.eBottom(),
447  mySCHelper.eLeft(),
448  mySCHelper.eRight(),
449  mySCHelper.e2x5Max(),
450  mySCHelper.e2x5Top(),
451  mySCHelper.e2x5Bottom(),
452  mySCHelper.e2x5Left(),
453  mySCHelper.e2x5Right(),
454  mySCHelper.ietaSeed(),
455  mySCHelper.iphiSeed(),
456  mySCHelper.etaCrySeed(),
457  mySCHelper.phiCrySeed(),
458  mySCHelper.preshowerEnergyOverRaw(),
459  ele->ecalDrivenSeed(),
460  printDebug);
461  } else if (fVersionType == kWithTrkVarV1) {
462  return regressionUncertaintyWithTrkVarV1(mySCHelper.rawEnergy(),
463  mySCHelper.eta(),
464  mySCHelper.phi(),
465  mySCHelper.r9(),
466  mySCHelper.etaWidth(),
467  mySCHelper.phiWidth(),
468  mySCHelper.clustersSize(),
469  mySCHelper.hadronicOverEm(),
470  rho,
471  nvertices,
472  mySCHelper.seedEta(),
473  mySCHelper.seedPhi(),
474  mySCHelper.seedEnergy(),
475  mySCHelper.e3x3(),
476  mySCHelper.e5x5(),
477  mySCHelper.sigmaIetaIeta(),
478  mySCHelper.spp(),
479  mySCHelper.sep(),
480  mySCHelper.eMax(),
481  mySCHelper.e2nd(),
482  mySCHelper.eTop(),
483  mySCHelper.eBottom(),
484  mySCHelper.eLeft(),
485  mySCHelper.eRight(),
486  mySCHelper.e2x5Max(),
487  mySCHelper.e2x5Top(),
488  mySCHelper.e2x5Bottom(),
489  mySCHelper.e2x5Left(),
490  mySCHelper.e2x5Right(),
491  mySCHelper.ietaSeed(),
492  mySCHelper.iphiSeed(),
493  mySCHelper.etaCrySeed(),
494  mySCHelper.phiCrySeed(),
495  mySCHelper.preshowerEnergyOverRaw(),
496  ele->ecalDrivenSeed(),
497  ele->trackMomentumAtVtx().R(),
498  fmax(ele->fbrem(), -1.0),
499  ele->charge(),
500  fmin(ele->eSuperClusterOverP(), 20.0),
501  ele->trackMomentumError(),
503  ele->classification(),
504  printDebug);
505  } else if (fVersionType == kWithTrkVarV2) {
507  mySCHelper.rawEnergy(),
508  mySCHelper.eta(),
509  mySCHelper.phi(),
510  mySCHelper.r9(),
511  mySCHelper.etaWidth(),
512  mySCHelper.phiWidth(),
513  mySCHelper.clustersSize(),
514  mySCHelper.hadronicOverEm(),
515  rho,
516  nvertices,
517  mySCHelper.seedEta(),
518  mySCHelper.seedPhi(),
519  mySCHelper.seedEnergy(),
520  mySCHelper.e3x3(),
521  mySCHelper.e5x5(),
522  mySCHelper.sigmaIetaIeta(),
523  mySCHelper.spp(),
524  mySCHelper.sep(),
525  mySCHelper.eMax(),
526  mySCHelper.e2nd(),
527  mySCHelper.eTop(),
528  mySCHelper.eBottom(),
529  mySCHelper.eLeft(),
530  mySCHelper.eRight(),
531  mySCHelper.e2x5Max(),
532  mySCHelper.e2x5Top(),
533  mySCHelper.e2x5Bottom(),
534  mySCHelper.e2x5Left(),
535  mySCHelper.e2x5Right(),
536  mySCHelper.ietaSeed(),
537  mySCHelper.iphiSeed(),
538  mySCHelper.etaCrySeed(),
539  mySCHelper.phiCrySeed(),
540  mySCHelper.preshowerEnergyOverRaw(),
541  ele->ecalDrivenSeed(),
542  ele->trackMomentumAtVtx().R(),
543  fmax(ele->fbrem(), -1.0),
544  ele->charge(),
545  fmin(ele->eSuperClusterOverP(), 20.0),
546  ele->trackMomentumError(),
548  ele->classification(),
549  fmin(std::abs(ele->deltaEtaSuperClusterTrackAtVtx()), 0.6),
553  ele->gsfTrack()->chi2() / ele->gsfTrack()->ndof(),
554  (ele->closestCtfTrackRef().isNonnull() ? ele->closestCtfTrackRef()->hitPattern().trackerLayersWithMeasurement()
555  : -1),
556  fmin(ele->eEleClusterOverPout(), 20.0),
557  printDebug);
558  } else {
559  std::cout << "Warning: Electron Regression Type " << fVersionType
560  << " is not supported. Reverting to default electron momentum.\n";
561  return ele->p();
562  }
563 }
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
virtual TrackRef closestCtfTrackRef() const
Definition: GsfElectron.h:180
float trackMomentumError() const
Definition: GsfElectron.h:800
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
double eta() const final
momentum pseudorapidity
float eESClusters() const
float e2x5Max() const
bool isEBEtaGap() const
Definition: GsfElectron.h:333
float eSuperClusterOverP() const
Definition: GsfElectron.h:221
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
float esClusterEnergy(unsigned i) const
float sigmaIetaIeta() const
float subClusterE3x3(unsigned i) const
math::XYZVectorF trackMomentumAtVtx() const
Definition: GsfElectron.h:268
double pt() const final
transverse momentum
int charge() const final
electric charge
float fbrem() const
Definition: GsfElectron.h:726
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:336
float eBottom() const
bool isEB() const
Definition: GsfElectron.h:328
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
float etaWidth() const
float rawEnergy() const
float deltaEtaSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:225
float subClusterEnergy(unsigned i) const
float deltaPhiSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:229
float deltaPhiSuperClusterTrackAtVtx() const
Definition: GsfElectron.h:228
float eLeft() const
float preshowerEnergyOverRaw() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float eRight() const
float eEleClusterOverPout() const
Definition: GsfElectron.h:224
float e2x5Top() const
float hadronicOverEm() const
float phiWidth() const
float subClusterEmax(unsigned i) const
double p() const final
magnitude of momentum vector
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
Classification classification() const
Definition: GsfElectron.h:722
float seedEta() const
float correctedEcalEnergyError() const
Definition: GsfElectron.h:799
float deltaEtaSeedClusterTrackAtCalo() const
Definition: GsfElectron.h:226
bool isEBPhiGap() const
Definition: GsfElectron.h:334
float nPreshowerClusters() const
float seedPhi() const
float clustersSize() const
float subClusterEta(unsigned i) const
float seedEnergy() const
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 phi() const final
momentum azimuthal angle
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)
bool ecalDrivenSeed() const
Definition: GsfElectron.h:158
void ElectronEnergyRegressionEvaluate::initialize ( std::string  weightsFile,
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType  type 
)

Definition at line 27 of file ElectronEnergyRegressionEvaluate.cc.

References FrontierConditions_GlobalTag_cff::file, fIsInitialized, forestCorrection_eb, forestCorrection_ee, forestUncertainty_eb, forestUncertainty_ee, contentValuesFiles::fullPath, and fVersionType.

Referenced by RegressionEnergyPatElectronProducer::RegressionEnergyPatElectronProducer().

28  {
29  // Loading forest object according to different versions
30  TFile file(edm::FileInPath(weightsFile.c_str()).fullPath().c_str());
31 
32  forestCorrection_eb = (GBRForest *)file.Get("EBCorrection");
33  forestCorrection_ee = (GBRForest *)file.Get("EECorrection");
34  forestUncertainty_eb = (GBRForest *)file.Get("EBUncertainty");
35  forestUncertainty_ee = (GBRForest *)file.Get("EEUncertainty");
36 
37  // Just checking
38  assert(forestCorrection_eb);
39  assert(forestCorrection_ee);
40  assert(forestUncertainty_eb);
41  assert(forestUncertainty_ee);
42 
43  // Updating type and marking as initialized
45  fIsInitialized = kTRUE;
46 }
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 728 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kNoTrkVar, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergyUncertainty(), isInitialized(), and RegressionEnergyPatElectronProducer::produce().

762  {
763  // Checking if instance has been initialized
764  if (fIsInitialized == kFALSE) {
765  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
766  return 0;
767  }
768 
769  // Checking if type is correct
770  if (!(fVersionType == kNoTrkVar)) {
771  std::cout << "Error: Regression VersionType " << fVersionType
772  << " is not supported to use function regressionValueNoTrkVar.\n";
773  return 0;
774  }
775 
776  // Now applying regression according to version and (endcap/barrel)
777  float *vals = (std::abs(scEta) <= 1.479) ? new float[38] : new float[31];
778  if (std::abs(scEta) <= 1.479) { // Barrel
779  vals[0] = SCRawEnergy;
780  vals[1] = scEta;
781  vals[2] = scPhi;
782  vals[3] = R9;
783  vals[4] = E5x5Seed / SCRawEnergy;
784  vals[5] = etawidth;
785  vals[6] = phiwidth;
786  vals[7] = NClusters;
787  vals[8] = HoE;
788  vals[9] = rho;
789  vals[10] = vertices;
790  vals[11] = EtaSeed - scEta;
791  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
792  vals[13] = ESeed / SCRawEnergy;
793  vals[14] = E3x3Seed / ESeed;
794  vals[15] = E5x5Seed / ESeed;
795  vals[16] = see;
796  vals[17] = spp;
797  vals[18] = sep;
798  vals[19] = EMaxSeed / ESeed;
799  vals[20] = E2ndSeed / ESeed;
800  vals[21] = ETopSeed / ESeed;
801  vals[22] = EBottomSeed / ESeed;
802  vals[23] = ELeftSeed / ESeed;
803  vals[24] = ERightSeed / ESeed;
804  vals[25] = E2x5MaxSeed / ESeed;
805  vals[26] = E2x5TopSeed / ESeed;
806  vals[27] = E2x5BottomSeed / ESeed;
807  vals[28] = E2x5LeftSeed / ESeed;
808  vals[29] = E2x5RightSeed / ESeed;
809  vals[30] = IEtaSeed;
810  vals[31] = IPhiSeed;
811  vals[32] = ((int)IEtaSeed) % 5;
812  vals[33] = ((int)IPhiSeed) % 2;
813  vals[34] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
814  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
815  vals[35] = ((int)IPhiSeed) % 20;
816  vals[36] = EtaCrySeed;
817  vals[37] = PhiCrySeed;
818  } else { // Endcap
819  vals[0] = SCRawEnergy;
820  vals[1] = scEta;
821  vals[2] = scPhi;
822  vals[3] = R9;
823  vals[4] = E5x5Seed / SCRawEnergy;
824  vals[5] = etawidth;
825  vals[6] = phiwidth;
826  vals[7] = NClusters;
827  vals[8] = HoE;
828  vals[9] = rho;
829  vals[10] = vertices;
830  vals[11] = EtaSeed - scEta;
831  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
832  vals[13] = ESeed / SCRawEnergy;
833  vals[14] = E3x3Seed / ESeed;
834  vals[15] = E5x5Seed / ESeed;
835  vals[16] = see;
836  vals[17] = spp;
837  vals[18] = sep;
838  vals[19] = EMaxSeed / ESeed;
839  vals[20] = E2ndSeed / ESeed;
840  vals[21] = ETopSeed / ESeed;
841  vals[22] = EBottomSeed / ESeed;
842  vals[23] = ELeftSeed / ESeed;
843  vals[24] = ERightSeed / ESeed;
844  vals[25] = E2x5MaxSeed / ESeed;
845  vals[26] = E2x5TopSeed / ESeed;
846  vals[27] = E2x5BottomSeed / ESeed;
847  vals[28] = E2x5LeftSeed / ESeed;
848  vals[29] = E2x5RightSeed / ESeed;
849  vals[30] = PreShowerOverRaw;
850  }
851 
852  // Now evaluating the regression
853  double regressionResult = 0;
854  Int_t BinIndex = -1;
855 
856  if (fVersionType == kNoTrkVar) {
857  if (std::abs(scEta) <= 1.479) {
858  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
859  BinIndex = 0;
860  } else {
861  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
862  BinIndex = 1;
863  }
864  }
865 
866  //print debug
867  if (printDebug) {
868  if (std::abs(scEta) <= 1.479) {
869  std::cout << "Barrel :";
870  for (unsigned int v = 0; v < 38; ++v)
871  std::cout << vals[v] << ", ";
872  std::cout << "\n";
873  } else {
874  std::cout << "Endcap :";
875  for (unsigned int v = 0; v < 31; ++v)
876  std::cout << vals[v] << ", ";
877  std::cout << "\n";
878  }
879  std::cout << "BinIndex : " << BinIndex << "\n";
880  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
881  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
882  }
883 
884  // Cleaning up and returning
885  delete[] vals;
886  return regressionResult;
887 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 1053 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kNoTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergyUncertainty(), and isInitialized().

1088  {
1089  // Checking if instance has been initialized
1090  if (fIsInitialized == kFALSE) {
1091  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1092  return 0;
1093  }
1094 
1095  // Checking if type is correct
1096  if (!(fVersionType == kNoTrkVarV1)) {
1097  std::cout << "Error: Regression VersionType " << fVersionType
1098  << " is not supported to use function regressionValueNoTrkVar.\n";
1099  return 0;
1100  }
1101 
1102  // Now applying regression according to version and (endcap/barrel)
1103  float *vals = (std::abs(scEta) <= 1.479) ? new float[39] : new float[32];
1104  if (std::abs(scEta) <= 1.479) { // Barrel
1105  vals[0] = SCRawEnergy;
1106  vals[1] = scEta;
1107  vals[2] = scPhi;
1108  vals[3] = R9;
1109  vals[4] = E5x5Seed / SCRawEnergy;
1110  vals[5] = etawidth;
1111  vals[6] = phiwidth;
1112  vals[7] = NClusters;
1113  vals[8] = HoE;
1114  vals[9] = rho;
1115  vals[10] = vertices;
1116  vals[11] = EtaSeed - scEta;
1117  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1118  vals[13] = ESeed / SCRawEnergy;
1119  vals[14] = E3x3Seed / ESeed;
1120  vals[15] = E5x5Seed / ESeed;
1121  vals[16] = see;
1122  vals[17] = spp;
1123  vals[18] = sep;
1124  vals[19] = EMaxSeed / ESeed;
1125  vals[20] = E2ndSeed / ESeed;
1126  vals[21] = ETopSeed / ESeed;
1127  vals[22] = EBottomSeed / ESeed;
1128  vals[23] = ELeftSeed / ESeed;
1129  vals[24] = ERightSeed / ESeed;
1130  vals[25] = E2x5MaxSeed / ESeed;
1131  vals[26] = E2x5TopSeed / ESeed;
1132  vals[27] = E2x5BottomSeed / ESeed;
1133  vals[28] = E2x5LeftSeed / ESeed;
1134  vals[29] = E2x5RightSeed / ESeed;
1135  vals[30] = IsEcalDriven;
1136  vals[31] = IEtaSeed;
1137  vals[32] = IPhiSeed;
1138  vals[33] = ((int)IEtaSeed) % 5;
1139  vals[34] = ((int)IPhiSeed) % 2;
1140  vals[35] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
1141  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
1142  vals[36] = ((int)IPhiSeed) % 20;
1143  vals[37] = EtaCrySeed;
1144  vals[38] = PhiCrySeed;
1145  } else { // Endcap
1146  vals[0] = SCRawEnergy;
1147  vals[1] = scEta;
1148  vals[2] = scPhi;
1149  vals[3] = R9;
1150  vals[4] = E5x5Seed / SCRawEnergy;
1151  vals[5] = etawidth;
1152  vals[6] = phiwidth;
1153  vals[7] = NClusters;
1154  vals[8] = HoE;
1155  vals[9] = rho;
1156  vals[10] = vertices;
1157  vals[11] = EtaSeed - scEta;
1158  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1159  vals[13] = ESeed / SCRawEnergy;
1160  vals[14] = E3x3Seed / ESeed;
1161  vals[15] = E5x5Seed / ESeed;
1162  vals[16] = see;
1163  vals[17] = spp;
1164  vals[18] = sep;
1165  vals[19] = EMaxSeed / ESeed;
1166  vals[20] = E2ndSeed / ESeed;
1167  vals[21] = ETopSeed / ESeed;
1168  vals[22] = EBottomSeed / ESeed;
1169  vals[23] = ELeftSeed / ESeed;
1170  vals[24] = ERightSeed / ESeed;
1171  vals[25] = E2x5MaxSeed / ESeed;
1172  vals[26] = E2x5TopSeed / ESeed;
1173  vals[27] = E2x5BottomSeed / ESeed;
1174  vals[28] = E2x5LeftSeed / ESeed;
1175  vals[29] = E2x5RightSeed / ESeed;
1176  vals[30] = IsEcalDriven;
1177  vals[31] = PreShowerOverRaw;
1178  }
1179 
1180  // Now evaluating the regression
1181  double regressionResult = 0;
1182  Int_t BinIndex = -1;
1183 
1184  if (fVersionType == kNoTrkVarV1) {
1185  if (std::abs(scEta) <= 1.479) {
1186  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1187  BinIndex = 0;
1188  } else {
1189  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1190  BinIndex = 1;
1191  }
1192  }
1193 
1194  //print debug
1195  if (printDebug) {
1196  if (std::abs(scEta) <= 1.479) {
1197  std::cout << "Barrel :";
1198  for (unsigned int v = 0; v < 39; ++v)
1199  std::cout << vals[v] << ", ";
1200  std::cout << "\n";
1201  } else {
1202  std::cout << "Endcap :";
1203  for (unsigned int v = 0; v < 32; ++v)
1204  std::cout << vals[v] << ", ";
1205  std::cout << "\n";
1206  }
1207  std::cout << "BinIndex : " << BinIndex << "\n";
1208  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1209  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1210  }
1211 
1212  // Cleaning up and returning
1213  delete[] vals;
1214  return regressionResult;
1215 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 3329 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithSubCluVar, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergyUncertainty(), isInitialized(), and RegressionEnergyPatElectronProducer::produce().

3395  {
3396  // Checking if instance has been initialized
3397  if (fIsInitialized == kFALSE) {
3398  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
3399  return 0;
3400  }
3401 
3402  // Checking if type is correct
3403  if (!(fVersionType == kWithSubCluVar)) {
3404  std::cout << "Error: Regression VersionType " << fVersionType
3405  << " is not supported to use function regressionValueWithSubClusters.\n";
3406  return 0;
3407  }
3408 
3409  // Now applying regression according to version and (endcap/barrel)
3410  float *vals = (isEB) ? new float[61] : new float[65];
3411  if (isEB) { // Barrel
3412  vals[0] = rho;
3413  vals[1] = vertices;
3414  vals[2] = isEcalDriven;
3415  vals[3] = isEtaGap;
3416  vals[4] = isPhiGap;
3417  vals[5] = isDeeGap;
3418  vals[6] = SCRawEnergy;
3419  vals[7] = scEta;
3420  vals[8] = scPhi;
3421  vals[9] = R9;
3422  vals[10] = etawidth;
3423  vals[11] = phiwidth;
3424  vals[12] = NClusters;
3425  vals[13] = HoE;
3426  vals[14] = EtaSeed - scEta;
3427  vals[15] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
3428  vals[16] = ESeed / SCRawEnergy;
3429  vals[17] = E3x3Seed / ESeed;
3430  vals[18] = E5x5Seed / SCRawEnergy;
3431  vals[19] = E5x5Seed / ESeed;
3432  vals[20] = EMaxSeed / ESeed;
3433  vals[21] = E2ndSeed / ESeed;
3434  vals[22] = ETopSeed / ESeed;
3435  vals[23] = EBottomSeed / ESeed;
3436  vals[24] = ELeftSeed / ESeed;
3437  vals[25] = ERightSeed / ESeed;
3438  vals[26] = E2x5MaxSeed / ESeed;
3439  vals[27] = E2x5TopSeed / ESeed;
3440  vals[28] = E2x5BottomSeed / ESeed;
3441  vals[29] = E2x5LeftSeed / ESeed;
3442  vals[30] = E2x5RightSeed / ESeed;
3443  vals[31] = see;
3444  vals[32] = spp;
3445  vals[33] = sep;
3446  vals[34] = phiwidth / etawidth;
3447  vals[35] = (ELeftSeed + ERightSeed == 0. ? 0. : (ELeftSeed - ERightSeed) / (ELeftSeed + ERightSeed));
3448  vals[36] = (ETopSeed + EBottomSeed == 0. ? 0. : (ETopSeed - EBottomSeed) / (ETopSeed + EBottomSeed));
3449  vals[37] = ESubs / SCRawEnergy;
3450  vals[38] = ESub1 / SCRawEnergy;
3451  vals[39] = (NClusters <= 1 ? 999. : EtaSub1 - EtaSeed);
3452  vals[40] = (NClusters <= 1 ? 999. : atan2(sin(PhiSub1 - PhiSeed), cos(PhiSub1 - PhiSeed)));
3453  vals[41] = (NClusters <= 1 ? 0. : EMaxSub1 / ESub1);
3454  vals[42] = (NClusters <= 1 ? 0. : E3x3Sub1 / ESub1);
3455  vals[43] = ESub2 / SCRawEnergy;
3456  vals[44] = (NClusters <= 2 ? 999. : EtaSub2 - EtaSeed);
3457  vals[45] = (NClusters <= 2 ? 999. : atan2(sin(PhiSub2 - PhiSeed), cos(PhiSub2 - PhiSeed)));
3458  vals[46] = (NClusters <= 2 ? 0. : EMaxSub2 / ESub2);
3459  vals[47] = (NClusters <= 2 ? 0. : E3x3Sub2 / ESub2);
3460  vals[48] = ESub3 / SCRawEnergy;
3461  vals[49] = (NClusters <= 3 ? 999. : EtaSub3 - EtaSeed);
3462  vals[50] = (NClusters <= 3 ? 999. : atan2(sin(PhiSub3 - PhiSeed), cos(PhiSub3 - PhiSeed)));
3463  vals[51] = (NClusters <= 3 ? 0. : EMaxSub3 / ESub3);
3464  vals[52] = (NClusters <= 3 ? 0. : E3x3Sub3 / ESub3);
3465  vals[53] = IEtaSeed;
3466  vals[54] = ((int)IEtaSeed) % 5;
3467  vals[55] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
3468  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
3469  vals[56] = IPhiSeed;
3470  vals[57] = ((int)IPhiSeed) % 2;
3471  vals[58] = ((int)IPhiSeed) % 20;
3472  vals[59] = EtaCrySeed;
3473  vals[60] = PhiCrySeed;
3474  } else { // Endcap
3475  vals[0] = rho;
3476  vals[1] = vertices;
3477  vals[2] = isEcalDriven;
3478  vals[3] = isEtaGap;
3479  vals[4] = isPhiGap;
3480  vals[5] = isDeeGap;
3481  vals[6] = SCRawEnergy;
3482  vals[7] = scEta;
3483  vals[8] = scPhi;
3484  vals[9] = R9;
3485  vals[10] = etawidth;
3486  vals[11] = phiwidth;
3487  vals[12] = NClusters;
3488  vals[13] = HoE;
3489  vals[14] = EtaSeed - scEta;
3490  vals[15] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
3491  vals[16] = ESeed / SCRawEnergy;
3492  vals[17] = E3x3Seed / ESeed;
3493  vals[18] = E5x5Seed / SCRawEnergy;
3494  vals[19] = E5x5Seed / ESeed;
3495  vals[20] = EMaxSeed / ESeed;
3496  vals[21] = E2ndSeed / ESeed;
3497  vals[22] = ETopSeed / ESeed;
3498  vals[23] = EBottomSeed / ESeed;
3499  vals[24] = ELeftSeed / ESeed;
3500  vals[25] = ERightSeed / ESeed;
3501  vals[26] = E2x5MaxSeed / ESeed;
3502  vals[27] = E2x5TopSeed / ESeed;
3503  vals[28] = E2x5BottomSeed / ESeed;
3504  vals[29] = E2x5LeftSeed / ESeed;
3505  vals[30] = E2x5RightSeed / ESeed;
3506  vals[31] = see;
3507  vals[32] = spp;
3508  vals[33] = sep;
3509  vals[34] = phiwidth / etawidth;
3510  vals[35] = (ELeftSeed + ERightSeed == 0. ? 0. : (ELeftSeed - ERightSeed) / (ELeftSeed + ERightSeed));
3511  vals[36] = (ETopSeed + EBottomSeed == 0. ? 0. : (ETopSeed - EBottomSeed) / (ETopSeed + EBottomSeed));
3512  vals[37] = ESubs / SCRawEnergy;
3513  vals[38] = ESub1 / SCRawEnergy;
3514  vals[39] = (NClusters <= 1 ? 999. : EtaSub1 - EtaSeed);
3515  vals[40] = (NClusters <= 1 ? 999. : atan2(sin(PhiSub1 - PhiSeed), cos(PhiSub1 - PhiSeed)));
3516  vals[41] = (NClusters <= 1 ? 0. : EMaxSub1 / ESub1);
3517  vals[42] = (NClusters <= 1 ? 0. : E3x3Sub1 / ESub1);
3518  vals[43] = ESub2 / SCRawEnergy;
3519  vals[44] = (NClusters <= 2 ? 999. : EtaSub2 - EtaSeed);
3520  vals[45] = (NClusters <= 2 ? 999. : atan2(sin(PhiSub2 - PhiSeed), cos(PhiSub2 - PhiSeed)));
3521  vals[46] = (NClusters <= 2 ? 0. : EMaxSub2 / ESub2);
3522  vals[47] = (NClusters <= 2 ? 0. : E3x3Sub2 / ESub2);
3523  vals[48] = ESub3 / SCRawEnergy;
3524  vals[49] = (NClusters <= 3 ? 999. : EtaSub3 - EtaSeed);
3525  vals[50] = (NClusters <= 3 ? 999. : atan2(sin(PhiSub3 - PhiSeed), cos(PhiSub3 - PhiSeed)));
3526  vals[51] = (NClusters <= 3 ? 0. : EMaxSub3 / ESub3);
3527  vals[52] = (NClusters <= 3 ? 0. : E3x3Sub3 / ESub3);
3528  vals[53] = PreShowerOverRaw;
3529  vals[54] = NPshwClusters;
3530  vals[55] = EPshwSubs / SCRawEnergy;
3531  vals[56] = EPshwSub1 / SCRawEnergy;
3532  vals[57] = (NPshwClusters <= 0 ? 999. : EtaPshwSub1 - EtaSeed);
3533  vals[58] = (NPshwClusters <= 0 ? 999. : atan2(sin(PhiPshwSub1 - PhiSeed), cos(PhiPshwSub1 - PhiSeed)));
3534  vals[59] = EPshwSub2 / SCRawEnergy;
3535  vals[60] = (NPshwClusters <= 1 ? 999. : EtaPshwSub2 - EtaSeed);
3536  vals[61] = (NPshwClusters <= 1 ? 999. : atan2(sin(PhiPshwSub2 - PhiSeed), cos(PhiPshwSub2 - PhiSeed)));
3537  vals[62] = EPshwSub3 / SCRawEnergy;
3538  vals[63] = (NPshwClusters <= 2 ? 999. : EtaPshwSub3 - EtaSeed);
3539  vals[64] = (NPshwClusters <= 2 ? 999. : atan2(sin(PhiPshwSub3 - PhiSeed), cos(PhiPshwSub3 - PhiSeed)));
3540  }
3541 
3542  // Now evaluating the regression
3543  double regressionResult = 0;
3544  Int_t BinIndex = -1;
3545 
3546  if (fVersionType == kWithSubCluVar) {
3547  if (isEB) {
3548  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
3549  BinIndex = 0;
3550  } else {
3551  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
3552  BinIndex = 1;
3553  }
3554  }
3555 
3556  //print debug
3557  if (printDebug) {
3558  if (isEB) {
3559  std::cout << "Barrel :";
3560  for (unsigned int v = 0; v < 38; ++v)
3561  std::cout << vals[v] << ", ";
3562  std::cout << "\n";
3563  } else {
3564  std::cout << "Endcap :";
3565  for (unsigned int v = 0; v < 31; ++v)
3566  std::cout << vals[v] << ", ";
3567  std::cout << "\n";
3568  }
3569  std::cout << "BinIndex : " << BinIndex << "\n";
3570  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3571  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
3572  }
3573 
3574  // Cleaning up and returning
3575  delete[] vals;
3576  return regressionResult;
3577 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 1391 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVar, DiDispStaMuonMonitor_cfi::pt, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by isInitialized(), and RegressionEnergyPatElectronProducer::produce().

1431  {
1432  // Checking if instance has been initialized
1433  if (fIsInitialized == kFALSE) {
1434  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1435  return 0;
1436  }
1437 
1438  // Checking if fVersionType is correct
1439  assert(fVersionType == kWithTrkVar);
1440 
1441  float *vals = (std::abs(scEta) <= 1.479) ? new float[43] : new float[36];
1442  if (std::abs(scEta) <= 1.479) { // Barrel
1443  vals[0] = SCRawEnergy;
1444  vals[1] = scEta;
1445  vals[2] = scPhi;
1446  vals[3] = R9;
1447  vals[4] = E5x5Seed / SCRawEnergy;
1448  vals[5] = etawidth;
1449  vals[6] = phiwidth;
1450  vals[7] = NClusters;
1451  vals[8] = HoE;
1452  vals[9] = rho;
1453  vals[10] = vertices;
1454  vals[11] = EtaSeed - scEta;
1455  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1456  vals[13] = ESeed / SCRawEnergy;
1457  vals[14] = E3x3Seed / ESeed;
1458  vals[15] = E5x5Seed / ESeed;
1459  vals[16] = see;
1460  vals[17] = spp;
1461  vals[18] = sep;
1462  vals[19] = EMaxSeed / ESeed;
1463  vals[20] = E2ndSeed / ESeed;
1464  vals[21] = ETopSeed / ESeed;
1465  vals[22] = EBottomSeed / ESeed;
1466  vals[23] = ELeftSeed / ESeed;
1467  vals[24] = ERightSeed / ESeed;
1468  vals[25] = E2x5MaxSeed / ESeed;
1469  vals[26] = E2x5TopSeed / ESeed;
1470  vals[27] = E2x5BottomSeed / ESeed;
1471  vals[28] = E2x5LeftSeed / ESeed;
1472  vals[29] = E2x5RightSeed / ESeed;
1473  vals[30] = pt;
1474  vals[31] = GsfTrackPIn;
1475  vals[32] = fbrem;
1476  vals[33] = Charge;
1477  vals[34] = EoP;
1478  vals[35] = IEtaSeed;
1479  vals[36] = IPhiSeed;
1480  vals[37] = ((int)IEtaSeed) % 5;
1481  vals[38] = ((int)IPhiSeed) % 2;
1482  vals[39] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
1483  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
1484  vals[40] = ((int)IPhiSeed) % 20;
1485  vals[41] = EtaCrySeed;
1486  vals[42] = PhiCrySeed;
1487  }
1488 
1489  else { // Endcap
1490  vals[0] = SCRawEnergy;
1491  vals[1] = scEta;
1492  vals[2] = scPhi;
1493  vals[3] = R9;
1494  vals[4] = E5x5Seed / SCRawEnergy;
1495  vals[5] = etawidth;
1496  vals[6] = phiwidth;
1497  vals[7] = NClusters;
1498  vals[8] = HoE;
1499  vals[9] = rho;
1500  vals[10] = vertices;
1501  vals[11] = EtaSeed - scEta;
1502  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1503  vals[13] = ESeed / SCRawEnergy;
1504  vals[14] = E3x3Seed / ESeed;
1505  vals[15] = E5x5Seed / ESeed;
1506  vals[16] = see;
1507  vals[17] = spp;
1508  vals[18] = sep;
1509  vals[19] = EMaxSeed / ESeed;
1510  vals[20] = E2ndSeed / ESeed;
1511  vals[21] = ETopSeed / ESeed;
1512  vals[22] = EBottomSeed / ESeed;
1513  vals[23] = ELeftSeed / ESeed;
1514  vals[24] = ERightSeed / ESeed;
1515  vals[25] = E2x5MaxSeed / ESeed;
1516  vals[26] = E2x5TopSeed / ESeed;
1517  vals[27] = E2x5BottomSeed / ESeed;
1518  vals[28] = E2x5LeftSeed / ESeed;
1519  vals[29] = E2x5RightSeed / ESeed;
1520  vals[30] = pt;
1521  vals[31] = GsfTrackPIn;
1522  vals[32] = fbrem;
1523  vals[33] = Charge;
1524  vals[34] = EoP;
1525  vals[35] = PreShowerOverRaw;
1526  }
1527 
1528  // Now evaluating the regression
1529  double regressionResult = 0;
1530 
1531  if (fVersionType == kWithTrkVar) {
1532  if (std::abs(scEta) <= 1.479)
1533  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1534  else
1535  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1536  }
1537 
1538  //print debug
1539  if (printDebug) {
1540  if (scEta <= 1.479) {
1541  std::cout << "Barrel :";
1542  for (unsigned int v = 0; v < 43; ++v)
1543  std::cout << vals[v] << ", ";
1544  std::cout << "\n";
1545  } else {
1546  std::cout << "Endcap :";
1547  for (unsigned int v = 0; v < 36; ++v)
1548  std::cout << vals[v] << ", ";
1549  std::cout << "\n";
1550  }
1551  std::cout << "pt = " << pt << " : SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw
1552  << std::endl;
1553  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1554  }
1555 
1556  // Cleaning up and returning
1557  delete[] vals;
1558  return regressionResult;
1559 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 1738 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergyUncertainty(), and isInitialized().

1780  {
1781  // Checking if instance has been initialized
1782  if (fIsInitialized == kFALSE) {
1783  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1784  return 0;
1785  }
1786 
1787  // Checking if fVersionType is correct
1788  assert(fVersionType == kWithTrkVarV1);
1789 
1790  float *vals = (std::abs(scEta) <= 1.479) ? new float[46] : new float[39];
1791  if (std::abs(scEta) <= 1.479) { // Barrel
1792  vals[0] = SCRawEnergy;
1793  vals[1] = scEta;
1794  vals[2] = scPhi;
1795  vals[3] = R9;
1796  vals[4] = E5x5Seed / SCRawEnergy;
1797  vals[5] = etawidth;
1798  vals[6] = phiwidth;
1799  vals[7] = NClusters;
1800  vals[8] = HoE;
1801  vals[9] = rho;
1802  vals[10] = vertices;
1803  vals[11] = EtaSeed - scEta;
1804  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1805  vals[13] = ESeed / SCRawEnergy;
1806  vals[14] = E3x3Seed / ESeed;
1807  vals[15] = E5x5Seed / ESeed;
1808  vals[16] = see;
1809  vals[17] = spp;
1810  vals[18] = sep;
1811  vals[19] = EMaxSeed / ESeed;
1812  vals[20] = E2ndSeed / ESeed;
1813  vals[21] = ETopSeed / ESeed;
1814  vals[22] = EBottomSeed / ESeed;
1815  vals[23] = ELeftSeed / ESeed;
1816  vals[24] = ERightSeed / ESeed;
1817  vals[25] = E2x5MaxSeed / ESeed;
1818  vals[26] = E2x5TopSeed / ESeed;
1819  vals[27] = E2x5BottomSeed / ESeed;
1820  vals[28] = E2x5LeftSeed / ESeed;
1821  vals[29] = E2x5RightSeed / ESeed;
1822  vals[30] = IsEcalDriven;
1823  vals[31] = GsfTrackPIn;
1824  vals[32] = fbrem;
1825  vals[33] = Charge;
1826  vals[34] = EoP;
1827  vals[35] = TrackMomentumError / GsfTrackPIn;
1828  vals[36] = EcalEnergyError / SCRawEnergy;
1829  vals[37] = Classification;
1830  vals[38] = IEtaSeed;
1831  vals[39] = IPhiSeed;
1832  vals[40] = ((int)IEtaSeed) % 5;
1833  vals[41] = ((int)IPhiSeed) % 2;
1834  vals[42] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
1835  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
1836  vals[43] = ((int)IPhiSeed) % 20;
1837  vals[44] = EtaCrySeed;
1838  vals[45] = PhiCrySeed;
1839  }
1840 
1841  else { // Endcap
1842  vals[0] = SCRawEnergy;
1843  vals[1] = scEta;
1844  vals[2] = scPhi;
1845  vals[3] = R9;
1846  vals[4] = E5x5Seed / SCRawEnergy;
1847  vals[5] = etawidth;
1848  vals[6] = phiwidth;
1849  vals[7] = NClusters;
1850  vals[8] = HoE;
1851  vals[9] = rho;
1852  vals[10] = vertices;
1853  vals[11] = EtaSeed - scEta;
1854  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1855  vals[13] = ESeed / SCRawEnergy;
1856  vals[14] = E3x3Seed / ESeed;
1857  vals[15] = E5x5Seed / ESeed;
1858  vals[16] = see;
1859  vals[17] = spp;
1860  vals[18] = sep;
1861  vals[19] = EMaxSeed / ESeed;
1862  vals[20] = E2ndSeed / ESeed;
1863  vals[21] = ETopSeed / ESeed;
1864  vals[22] = EBottomSeed / ESeed;
1865  vals[23] = ELeftSeed / ESeed;
1866  vals[24] = ERightSeed / ESeed;
1867  vals[25] = E2x5MaxSeed / ESeed;
1868  vals[26] = E2x5TopSeed / ESeed;
1869  vals[27] = E2x5BottomSeed / ESeed;
1870  vals[28] = E2x5LeftSeed / ESeed;
1871  vals[29] = E2x5RightSeed / ESeed;
1872  vals[30] = IsEcalDriven;
1873  vals[31] = GsfTrackPIn;
1874  vals[32] = fbrem;
1875  vals[33] = Charge;
1876  vals[34] = EoP;
1877  vals[35] = TrackMomentumError / GsfTrackPIn;
1878  vals[36] = EcalEnergyError / SCRawEnergy;
1879  vals[37] = Classification;
1880  vals[38] = PreShowerOverRaw;
1881  }
1882 
1883  // Now evaluating the regression
1884  double regressionResult = 0;
1885 
1886  if (fVersionType == kWithTrkVarV1) {
1887  if (std::abs(scEta) <= 1.479)
1888  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
1889  else
1890  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
1891  }
1892 
1893  //print debug
1894  if (printDebug) {
1895  if (std::abs(scEta) <= 1.479) {
1896  std::cout << "Barrel :";
1897  for (unsigned int v = 0; v < 46; ++v)
1898  std::cout << vals[v] << ", ";
1899  std::cout << "\n";
1900  } else {
1901  std::cout << "Endcap :";
1902  for (unsigned int v = 0; v < 39; ++v)
1903  std::cout << vals[v] << ", ";
1904  std::cout << "\n";
1905  }
1906  std::cout << " SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1907  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
1908  }
1909 
1910  // Cleaning up and returning
1911  delete[] vals;
1912  return regressionResult;
1913 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV1 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2096 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

2097  {
2098  // Checking if instance has been initialized
2099  if (fIsInitialized == kFALSE) {
2100  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2101  return 0;
2102  }
2103 
2104  // Checking if fVersionType is correct
2105  assert(fVersionType == kWithTrkVarV1);
2106 
2107  // Checking if fVersionType is correct
2108  assert(inputvars.size() == 42);
2109 
2110  double SCRawEnergy = inputvars[0];
2111  double scEta = inputvars[1];
2112  double scPhi = inputvars[2];
2113  double R9 = inputvars[3];
2114  double etawidth = inputvars[4];
2115  double phiwidth = inputvars[5];
2116  double NClusters = inputvars[6];
2117  double HoE = inputvars[7];
2118  double rho = inputvars[8];
2119  double vertices = inputvars[9];
2120  double EtaSeed = inputvars[10];
2121  double PhiSeed = inputvars[11];
2122  double ESeed = inputvars[12];
2123  double E3x3Seed = inputvars[13];
2124  double E5x5Seed = inputvars[14];
2125  double see = inputvars[15];
2126  double spp = inputvars[16];
2127  double sep = inputvars[17];
2128  double EMaxSeed = inputvars[18];
2129  double E2ndSeed = inputvars[19];
2130  double ETopSeed = inputvars[20];
2131  double EBottomSeed = inputvars[21];
2132  double ELeftSeed = inputvars[22];
2133  double ERightSeed = inputvars[23];
2134  double E2x5MaxSeed = inputvars[24];
2135  double E2x5TopSeed = inputvars[25];
2136  double E2x5BottomSeed = inputvars[26];
2137  double E2x5LeftSeed = inputvars[27];
2138  double E2x5RightSeed = inputvars[28];
2139  double IEtaSeed = inputvars[29];
2140  double IPhiSeed = inputvars[30];
2141  double EtaCrySeed = inputvars[31];
2142  double PhiCrySeed = inputvars[32];
2143  double PreShowerOverRaw = inputvars[33];
2144  int IsEcalDriven = inputvars[34];
2145  double GsfTrackPIn = inputvars[35];
2146  double fbrem = inputvars[36];
2147  double Charge = inputvars[37];
2148  double EoP = inputvars[38];
2149  double TrackMomentumError = inputvars[39];
2150  double EcalEnergyError = inputvars[40];
2151  int Classification = inputvars[41];
2152 
2153  float *vals = (std::abs(scEta) <= 1.479) ? new float[46] : new float[39];
2154  if (std::abs(scEta) <= 1.479) { // Barrel
2155  vals[0] = SCRawEnergy;
2156  vals[1] = scEta;
2157  vals[2] = scPhi;
2158  vals[3] = R9;
2159  vals[4] = E5x5Seed / SCRawEnergy;
2160  vals[5] = etawidth;
2161  vals[6] = phiwidth;
2162  vals[7] = NClusters;
2163  vals[8] = HoE;
2164  vals[9] = rho;
2165  vals[10] = vertices;
2166  vals[11] = EtaSeed - scEta;
2167  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2168  vals[13] = ESeed / SCRawEnergy;
2169  vals[14] = E3x3Seed / ESeed;
2170  vals[15] = E5x5Seed / ESeed;
2171  vals[16] = see;
2172  vals[17] = spp;
2173  vals[18] = sep;
2174  vals[19] = EMaxSeed / ESeed;
2175  vals[20] = E2ndSeed / ESeed;
2176  vals[21] = ETopSeed / ESeed;
2177  vals[22] = EBottomSeed / ESeed;
2178  vals[23] = ELeftSeed / ESeed;
2179  vals[24] = ERightSeed / ESeed;
2180  vals[25] = E2x5MaxSeed / ESeed;
2181  vals[26] = E2x5TopSeed / ESeed;
2182  vals[27] = E2x5BottomSeed / ESeed;
2183  vals[28] = E2x5LeftSeed / ESeed;
2184  vals[29] = E2x5RightSeed / ESeed;
2185  vals[30] = IsEcalDriven;
2186  vals[31] = GsfTrackPIn;
2187  vals[32] = fbrem;
2188  vals[33] = Charge;
2189  vals[34] = EoP;
2190  vals[35] = TrackMomentumError / GsfTrackPIn;
2191  vals[36] = EcalEnergyError / SCRawEnergy;
2192  vals[37] = Classification;
2193  vals[38] = IEtaSeed;
2194  vals[39] = IPhiSeed;
2195  vals[40] = ((int)IEtaSeed) % 5;
2196  vals[41] = ((int)IPhiSeed) % 2;
2197  vals[42] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2198  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2199  vals[43] = ((int)IPhiSeed) % 20;
2200  vals[44] = EtaCrySeed;
2201  vals[45] = PhiCrySeed;
2202  }
2203 
2204  else { // Endcap
2205  vals[0] = SCRawEnergy;
2206  vals[1] = scEta;
2207  vals[2] = scPhi;
2208  vals[3] = R9;
2209  vals[4] = E5x5Seed / SCRawEnergy;
2210  vals[5] = etawidth;
2211  vals[6] = phiwidth;
2212  vals[7] = NClusters;
2213  vals[8] = HoE;
2214  vals[9] = rho;
2215  vals[10] = vertices;
2216  vals[11] = EtaSeed - scEta;
2217  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2218  vals[13] = ESeed / SCRawEnergy;
2219  vals[14] = E3x3Seed / ESeed;
2220  vals[15] = E5x5Seed / ESeed;
2221  vals[16] = see;
2222  vals[17] = spp;
2223  vals[18] = sep;
2224  vals[19] = EMaxSeed / ESeed;
2225  vals[20] = E2ndSeed / ESeed;
2226  vals[21] = ETopSeed / ESeed;
2227  vals[22] = EBottomSeed / ESeed;
2228  vals[23] = ELeftSeed / ESeed;
2229  vals[24] = ERightSeed / ESeed;
2230  vals[25] = E2x5MaxSeed / ESeed;
2231  vals[26] = E2x5TopSeed / ESeed;
2232  vals[27] = E2x5BottomSeed / ESeed;
2233  vals[28] = E2x5LeftSeed / ESeed;
2234  vals[29] = E2x5RightSeed / ESeed;
2235  vals[30] = IsEcalDriven;
2236  vals[31] = GsfTrackPIn;
2237  vals[32] = fbrem;
2238  vals[33] = Charge;
2239  vals[34] = EoP;
2240  vals[35] = TrackMomentumError / GsfTrackPIn;
2241  vals[36] = EcalEnergyError / SCRawEnergy;
2242  vals[37] = Classification;
2243  vals[38] = PreShowerOverRaw;
2244  }
2245 
2246  // Now evaluating the regression
2247  double regressionResult = 0;
2248 
2249  if (fVersionType == kWithTrkVarV1) {
2250  if (std::abs(scEta) <= 1.479)
2251  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
2252  else
2253  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
2254  }
2255 
2256  //print debug
2257  if (printDebug) {
2258  if (std::abs(scEta) <= 1.479) {
2259  std::cout << "Barrel :";
2260  for (unsigned int v = 0; v < 46; ++v)
2261  std::cout << vals[v] << ", ";
2262  std::cout << "\n";
2263  } else {
2264  std::cout << "Endcap :";
2265  for (unsigned int v = 0; v < 39; ++v)
2266  std::cout << vals[v] << ", ";
2267  std::cout << "\n";
2268  }
2269  std::cout << " SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2270  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
2271  }
2272 
2273  // Cleaning up and returning
2274  delete[] vals;
2275  return regressionResult;
2276 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 2476 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergyUncertainty(), and isInitialized().

2525  {
2526  // Checking if instance has been initialized
2527  if (fIsInitialized == kFALSE) {
2528  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2529  return 0;
2530  }
2531 
2532  // Checking if fVersionType is correct
2533  assert(fVersionType == kWithTrkVarV2);
2534 
2535  float *vals = (std::abs(scEta) <= 1.479) ? new float[53] : new float[46];
2536  if (std::abs(scEta) <= 1.479) { // Barrel
2537  vals[0] = SCRawEnergy;
2538  vals[1] = scEta;
2539  vals[2] = scPhi;
2540  vals[3] = R9;
2541  vals[4] = E5x5Seed / SCRawEnergy;
2542  vals[5] = etawidth;
2543  vals[6] = phiwidth;
2544  vals[7] = NClusters;
2545  vals[8] = HoE;
2546  vals[9] = rho;
2547  vals[10] = vertices;
2548  vals[11] = EtaSeed - scEta;
2549  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2550  vals[13] = ESeed / SCRawEnergy;
2551  vals[14] = E3x3Seed / ESeed;
2552  vals[15] = E5x5Seed / ESeed;
2553  vals[16] = see;
2554  vals[17] = spp;
2555  vals[18] = sep;
2556  vals[19] = EMaxSeed / ESeed;
2557  vals[20] = E2ndSeed / ESeed;
2558  vals[21] = ETopSeed / ESeed;
2559  vals[22] = EBottomSeed / ESeed;
2560  vals[23] = ELeftSeed / ESeed;
2561  vals[24] = ERightSeed / ESeed;
2562  vals[25] = E2x5MaxSeed / ESeed;
2563  vals[26] = E2x5TopSeed / ESeed;
2564  vals[27] = E2x5BottomSeed / ESeed;
2565  vals[28] = E2x5LeftSeed / ESeed;
2566  vals[29] = E2x5RightSeed / ESeed;
2567  vals[30] = IsEcalDriven;
2568  vals[31] = GsfTrackPIn;
2569  vals[32] = fbrem;
2570  vals[33] = Charge;
2571  vals[34] = EoP;
2572  vals[35] = TrackMomentumError / GsfTrackPIn;
2573  vals[36] = EcalEnergyError / SCRawEnergy;
2574  vals[37] = Classification;
2575  vals[38] = detaIn;
2576  vals[39] = dphiIn;
2577  vals[40] = detaCalo;
2578  vals[41] = dphiCalo;
2579  vals[42] = GsfTrackChiSqr;
2580  vals[43] = KFTrackNLayers;
2581  vals[44] = ElectronEnergyOverPout;
2582  vals[45] = IEtaSeed;
2583  vals[46] = IPhiSeed;
2584  vals[47] = ((int)IEtaSeed) % 5;
2585  vals[48] = ((int)IPhiSeed) % 2;
2586  vals[49] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2587  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2588  vals[50] = ((int)IPhiSeed) % 20;
2589  vals[51] = EtaCrySeed;
2590  vals[52] = PhiCrySeed;
2591  }
2592 
2593  else { // Endcap
2594  vals[0] = SCRawEnergy;
2595  vals[1] = scEta;
2596  vals[2] = scPhi;
2597  vals[3] = R9;
2598  vals[4] = E5x5Seed / SCRawEnergy;
2599  vals[5] = etawidth;
2600  vals[6] = phiwidth;
2601  vals[7] = NClusters;
2602  vals[8] = HoE;
2603  vals[9] = rho;
2604  vals[10] = vertices;
2605  vals[11] = EtaSeed - scEta;
2606  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2607  vals[13] = ESeed / SCRawEnergy;
2608  vals[14] = E3x3Seed / ESeed;
2609  vals[15] = E5x5Seed / ESeed;
2610  vals[16] = see;
2611  vals[17] = spp;
2612  vals[18] = sep;
2613  vals[19] = EMaxSeed / ESeed;
2614  vals[20] = E2ndSeed / ESeed;
2615  vals[21] = ETopSeed / ESeed;
2616  vals[22] = EBottomSeed / ESeed;
2617  vals[23] = ELeftSeed / ESeed;
2618  vals[24] = ERightSeed / ESeed;
2619  vals[25] = E2x5MaxSeed / ESeed;
2620  vals[26] = E2x5TopSeed / ESeed;
2621  vals[27] = E2x5BottomSeed / ESeed;
2622  vals[28] = E2x5LeftSeed / ESeed;
2623  vals[29] = E2x5RightSeed / ESeed;
2624  vals[30] = IsEcalDriven;
2625  vals[31] = GsfTrackPIn;
2626  vals[32] = fbrem;
2627  vals[33] = Charge;
2628  vals[34] = EoP;
2629  vals[35] = TrackMomentumError / GsfTrackPIn;
2630  vals[36] = EcalEnergyError / SCRawEnergy;
2631  vals[37] = Classification;
2632  vals[38] = detaIn;
2633  vals[39] = dphiIn;
2634  vals[40] = detaCalo;
2635  vals[41] = dphiCalo;
2636  vals[42] = GsfTrackChiSqr;
2637  vals[43] = KFTrackNLayers;
2638  vals[44] = ElectronEnergyOverPout;
2639  vals[45] = PreShowerOverRaw;
2640  }
2641 
2642  // Now evaluating the regression
2643  double regressionResult = 0;
2644 
2645  if (fVersionType == kWithTrkVarV2) {
2646  if (std::abs(scEta) <= 1.479)
2647  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
2648  else
2649  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
2650  }
2651 
2652  //print debug
2653  if (printDebug) {
2654  if (std::abs(scEta) <= 1.479) {
2655  std::cout << "Barrel :";
2656  for (unsigned int v = 0; v < 53; ++v)
2657  std::cout << vals[v] << ", ";
2658  std::cout << "\n";
2659  } else {
2660  std::cout << "Endcap :";
2661  for (unsigned int v = 0; v < 46; ++v)
2662  std::cout << vals[v] << ", ";
2663  std::cout << "\n";
2664  }
2665  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2666  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
2667  }
2668 
2669  // Cleaning up and returning
2670  delete[] vals;
2671  return regressionResult;
2672 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double ElectronEnergyRegressionEvaluate::regressionUncertaintyWithTrkVarV2 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2876 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestUncertainty_eb, forestUncertainty_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

2877  {
2878  // Checking if instance has been initialized
2879  if (fIsInitialized == kFALSE) {
2880  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2881  return 0;
2882  }
2883 
2884  // Checking if fVersionType is correct
2885  assert(fVersionType == kWithTrkVarV2);
2886 
2887  // Checking if fVersionType is correct
2888  assert(inputvars.size() == 49);
2889 
2890  double SCRawEnergy = inputvars[0];
2891  double scEta = inputvars[1];
2892  double scPhi = inputvars[2];
2893  double R9 = inputvars[3];
2894  double etawidth = inputvars[4];
2895  double phiwidth = inputvars[5];
2896  double NClusters = inputvars[6];
2897  double HoE = inputvars[7];
2898  double rho = inputvars[8];
2899  double vertices = inputvars[9];
2900  double EtaSeed = inputvars[10];
2901  double PhiSeed = inputvars[11];
2902  double ESeed = inputvars[12];
2903  double E3x3Seed = inputvars[13];
2904  double E5x5Seed = inputvars[14];
2905  double see = inputvars[15];
2906  double spp = inputvars[16];
2907  double sep = inputvars[17];
2908  double EMaxSeed = inputvars[18];
2909  double E2ndSeed = inputvars[19];
2910  double ETopSeed = inputvars[20];
2911  double EBottomSeed = inputvars[21];
2912  double ELeftSeed = inputvars[22];
2913  double ERightSeed = inputvars[23];
2914  double E2x5MaxSeed = inputvars[24];
2915  double E2x5TopSeed = inputvars[25];
2916  double E2x5BottomSeed = inputvars[26];
2917  double E2x5LeftSeed = inputvars[27];
2918  double E2x5RightSeed = inputvars[28];
2919  double IEtaSeed = inputvars[29];
2920  double IPhiSeed = inputvars[30];
2921  double EtaCrySeed = inputvars[31];
2922  double PhiCrySeed = inputvars[32];
2923  double PreShowerOverRaw = inputvars[33];
2924  int IsEcalDriven = inputvars[34];
2925  double GsfTrackPIn = inputvars[35];
2926  double fbrem = inputvars[36];
2927  double Charge = inputvars[37];
2928  double EoP = inputvars[38];
2929  double TrackMomentumError = inputvars[39];
2930  double EcalEnergyError = inputvars[40];
2931  int Classification = inputvars[41];
2932  double detaIn = inputvars[42];
2933  double dphiIn = inputvars[43];
2934  double detaCalo = inputvars[44];
2935  double dphiCalo = inputvars[45];
2936  double GsfTrackChiSqr = inputvars[46];
2937  double KFTrackNLayers = inputvars[47];
2938  double ElectronEnergyOverPout = inputvars[48];
2939 
2940  float *vals = (std::abs(scEta) <= 1.479) ? new float[53] : new float[46];
2941  if (std::abs(scEta) <= 1.479) { // Barrel
2942  vals[0] = SCRawEnergy;
2943  vals[1] = scEta;
2944  vals[2] = scPhi;
2945  vals[3] = R9;
2946  vals[4] = E5x5Seed / SCRawEnergy;
2947  vals[5] = etawidth;
2948  vals[6] = phiwidth;
2949  vals[7] = NClusters;
2950  vals[8] = HoE;
2951  vals[9] = rho;
2952  vals[10] = vertices;
2953  vals[11] = EtaSeed - scEta;
2954  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2955  vals[13] = ESeed / SCRawEnergy;
2956  vals[14] = E3x3Seed / ESeed;
2957  vals[15] = E5x5Seed / ESeed;
2958  vals[16] = see;
2959  vals[17] = spp;
2960  vals[18] = sep;
2961  vals[19] = EMaxSeed / ESeed;
2962  vals[20] = E2ndSeed / ESeed;
2963  vals[21] = ETopSeed / ESeed;
2964  vals[22] = EBottomSeed / ESeed;
2965  vals[23] = ELeftSeed / ESeed;
2966  vals[24] = ERightSeed / ESeed;
2967  vals[25] = E2x5MaxSeed / ESeed;
2968  vals[26] = E2x5TopSeed / ESeed;
2969  vals[27] = E2x5BottomSeed / ESeed;
2970  vals[28] = E2x5LeftSeed / ESeed;
2971  vals[29] = E2x5RightSeed / ESeed;
2972  vals[30] = IsEcalDriven;
2973  vals[31] = GsfTrackPIn;
2974  vals[32] = fbrem;
2975  vals[33] = Charge;
2976  vals[34] = EoP;
2977  vals[35] = TrackMomentumError / GsfTrackPIn;
2978  vals[36] = EcalEnergyError / SCRawEnergy;
2979  vals[37] = Classification;
2980  vals[38] = detaIn;
2981  vals[39] = dphiIn;
2982  vals[40] = detaCalo;
2983  vals[41] = dphiCalo;
2984  vals[42] = GsfTrackChiSqr;
2985  vals[43] = KFTrackNLayers;
2986  vals[44] = ElectronEnergyOverPout;
2987  vals[45] = IEtaSeed;
2988  vals[46] = IPhiSeed;
2989  vals[47] = ((int)IEtaSeed) % 5;
2990  vals[48] = ((int)IPhiSeed) % 2;
2991  vals[49] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2992  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2993  vals[50] = ((int)IPhiSeed) % 20;
2994  vals[51] = EtaCrySeed;
2995  vals[52] = PhiCrySeed;
2996  }
2997 
2998  else { // Endcap
2999  vals[0] = SCRawEnergy;
3000  vals[1] = scEta;
3001  vals[2] = scPhi;
3002  vals[3] = R9;
3003  vals[4] = E5x5Seed / SCRawEnergy;
3004  vals[5] = etawidth;
3005  vals[6] = phiwidth;
3006  vals[7] = NClusters;
3007  vals[8] = HoE;
3008  vals[9] = rho;
3009  vals[10] = vertices;
3010  vals[11] = EtaSeed - scEta;
3011  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
3012  vals[13] = ESeed / SCRawEnergy;
3013  vals[14] = E3x3Seed / ESeed;
3014  vals[15] = E5x5Seed / ESeed;
3015  vals[16] = see;
3016  vals[17] = spp;
3017  vals[18] = sep;
3018  vals[19] = EMaxSeed / ESeed;
3019  vals[20] = E2ndSeed / ESeed;
3020  vals[21] = ETopSeed / ESeed;
3021  vals[22] = EBottomSeed / ESeed;
3022  vals[23] = ELeftSeed / ESeed;
3023  vals[24] = ERightSeed / ESeed;
3024  vals[25] = E2x5MaxSeed / ESeed;
3025  vals[26] = E2x5TopSeed / ESeed;
3026  vals[27] = E2x5BottomSeed / ESeed;
3027  vals[28] = E2x5LeftSeed / ESeed;
3028  vals[29] = E2x5RightSeed / ESeed;
3029  vals[30] = IsEcalDriven;
3030  vals[31] = GsfTrackPIn;
3031  vals[32] = fbrem;
3032  vals[33] = Charge;
3033  vals[34] = EoP;
3034  vals[35] = TrackMomentumError / GsfTrackPIn;
3035  vals[36] = EcalEnergyError / SCRawEnergy;
3036  vals[37] = Classification;
3037  vals[38] = detaIn;
3038  vals[39] = dphiIn;
3039  vals[40] = detaCalo;
3040  vals[41] = dphiCalo;
3041  vals[42] = GsfTrackChiSqr;
3042  vals[43] = KFTrackNLayers;
3043  vals[44] = ElectronEnergyOverPout;
3044  vals[45] = PreShowerOverRaw;
3045  }
3046 
3047  // Now evaluating the regression
3048  double regressionResult = 0;
3049 
3050  if (fVersionType == kWithTrkVarV2) {
3051  if (std::abs(scEta) <= 1.479)
3052  regressionResult = SCRawEnergy * forestUncertainty_eb->GetResponse(vals);
3053  else
3054  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestUncertainty_ee->GetResponse(vals);
3055  }
3056 
3057  //print debug
3058  if (printDebug) {
3059  if (std::abs(scEta) <= 1.479) {
3060  std::cout << "Barrel :";
3061  for (unsigned int v = 0; v < 53; ++v)
3062  std::cout << vals[v] << ", ";
3063  std::cout << "\n";
3064  } else {
3065  std::cout << "Endcap :";
3066  for (unsigned int v = 0; v < 46; ++v)
3067  std::cout << vals[v] << ", ";
3068  std::cout << "\n";
3069  }
3070  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3071  std::cout << "regression energy uncertainty = " << regressionResult << std::endl;
3072  }
3073 
3074  // Cleaning up and returning
3075  delete[] vals;
3076  return regressionResult;
3077 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 566 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kNoTrkVar, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergy(), isInitialized(), and RegressionEnergyPatElectronProducer::produce().

600  {
601  // Checking if instance has been initialized
602  if (fIsInitialized == kFALSE) {
603  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
604  return 0;
605  }
606 
607  // Checking if type is correct
608  if (!(fVersionType == kNoTrkVar)) {
609  std::cout << "Error: Regression VersionType " << fVersionType
610  << " is not supported to use function regressionValueNoTrkVar.\n";
611  return 0;
612  }
613  assert(forestCorrection_ee);
614 
615  // Now applying regression according to version and (endcap/barrel)
616  float *vals = (std::abs(scEta) <= 1.479) ? new float[38] : new float[31];
617  if (std::abs(scEta) <= 1.479) { // Barrel
618  vals[0] = SCRawEnergy;
619  vals[1] = scEta;
620  vals[2] = scPhi;
621  vals[3] = R9;
622  vals[4] = E5x5Seed / SCRawEnergy;
623  vals[5] = etawidth;
624  vals[6] = phiwidth;
625  vals[7] = NClusters;
626  vals[8] = HoE;
627  vals[9] = rho;
628  vals[10] = vertices;
629  vals[11] = EtaSeed - scEta;
630  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
631  vals[13] = ESeed / SCRawEnergy;
632  vals[14] = E3x3Seed / ESeed;
633  vals[15] = E5x5Seed / ESeed;
634  vals[16] = see;
635  vals[17] = spp;
636  vals[18] = sep;
637  vals[19] = EMaxSeed / ESeed;
638  vals[20] = E2ndSeed / ESeed;
639  vals[21] = ETopSeed / ESeed;
640  vals[22] = EBottomSeed / ESeed;
641  vals[23] = ELeftSeed / ESeed;
642  vals[24] = ERightSeed / ESeed;
643  vals[25] = E2x5MaxSeed / ESeed;
644  vals[26] = E2x5TopSeed / ESeed;
645  vals[27] = E2x5BottomSeed / ESeed;
646  vals[28] = E2x5LeftSeed / ESeed;
647  vals[29] = E2x5RightSeed / ESeed;
648  vals[30] = IEtaSeed;
649  vals[31] = IPhiSeed;
650  vals[32] = ((int)IEtaSeed) % 5;
651  vals[33] = ((int)IPhiSeed) % 2;
652  vals[34] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
653  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
654  vals[35] = ((int)IPhiSeed) % 20;
655  vals[36] = EtaCrySeed;
656  vals[37] = PhiCrySeed;
657  } else { // Endcap
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] = PreShowerOverRaw;
689  }
690 
691  // Now evaluating the regression
692  double regressionResult = 0;
693  Int_t BinIndex = -1;
694 
695  if (fVersionType == kNoTrkVar) {
696  if (std::abs(scEta) <= 1.479) {
697  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
698  BinIndex = 0;
699  } else {
700  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
701  BinIndex = 1;
702  }
703  }
704 
705  //print debug
706  if (printDebug) {
707  if (std::abs(scEta) <= 1.479) {
708  std::cout << "Barrel :";
709  for (unsigned int v = 0; v < 38; ++v)
710  std::cout << vals[v] << ", ";
711  std::cout << "\n";
712  } else {
713  std::cout << "Endcap :";
714  for (unsigned int v = 0; v < 31; ++v)
715  std::cout << vals[v] << ", ";
716  std::cout << "\n";
717  }
718  std::cout << "BinIndex : " << BinIndex << "\n";
719  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
720  std::cout << "regression energy = " << regressionResult << std::endl;
721  }
722 
723  // Cleaning up and returning
724  delete[] vals;
725  return regressionResult;
726 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 889 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kNoTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergy(), and isInitialized().

924  {
925  // Checking if instance has been initialized
926  if (fIsInitialized == kFALSE) {
927  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
928  return 0;
929  }
930 
931  // Checking if type is correct
932  if (!(fVersionType == kNoTrkVarV1)) {
933  std::cout << "Error: Regression VersionType " << fVersionType
934  << " is not supported to use function regressionValueNoTrkVar.\n";
935  return 0;
936  }
937 
938  // Now applying regression according to version and (endcap/barrel)
939  float *vals = (std::abs(scEta) <= 1.479) ? new float[39] : new float[32];
940  if (std::abs(scEta) <= 1.479) { // Barrel
941  vals[0] = SCRawEnergy;
942  vals[1] = scEta;
943  vals[2] = scPhi;
944  vals[3] = R9;
945  vals[4] = E5x5Seed / SCRawEnergy;
946  vals[5] = etawidth;
947  vals[6] = phiwidth;
948  vals[7] = NClusters;
949  vals[8] = HoE;
950  vals[9] = rho;
951  vals[10] = vertices;
952  vals[11] = EtaSeed - scEta;
953  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
954  vals[13] = ESeed / SCRawEnergy;
955  vals[14] = E3x3Seed / ESeed;
956  vals[15] = E5x5Seed / ESeed;
957  vals[16] = see;
958  vals[17] = spp;
959  vals[18] = sep;
960  vals[19] = EMaxSeed / ESeed;
961  vals[20] = E2ndSeed / ESeed;
962  vals[21] = ETopSeed / ESeed;
963  vals[22] = EBottomSeed / ESeed;
964  vals[23] = ELeftSeed / ESeed;
965  vals[24] = ERightSeed / ESeed;
966  vals[25] = E2x5MaxSeed / ESeed;
967  vals[26] = E2x5TopSeed / ESeed;
968  vals[27] = E2x5BottomSeed / ESeed;
969  vals[28] = E2x5LeftSeed / ESeed;
970  vals[29] = E2x5RightSeed / ESeed;
971  vals[30] = IsEcalDriven;
972  vals[31] = IEtaSeed;
973  vals[32] = IPhiSeed;
974  vals[33] = ((int)IEtaSeed) % 5;
975  vals[34] = ((int)IPhiSeed) % 2;
976  vals[35] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
977  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
978  vals[36] = ((int)IPhiSeed) % 20;
979  vals[37] = EtaCrySeed;
980  vals[38] = PhiCrySeed;
981  } else { // Endcap
982  vals[0] = SCRawEnergy;
983  vals[1] = scEta;
984  vals[2] = scPhi;
985  vals[3] = R9;
986  vals[4] = E5x5Seed / SCRawEnergy;
987  vals[5] = etawidth;
988  vals[6] = phiwidth;
989  vals[7] = NClusters;
990  vals[8] = HoE;
991  vals[9] = rho;
992  vals[10] = vertices;
993  vals[11] = EtaSeed - scEta;
994  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
995  vals[13] = ESeed / SCRawEnergy;
996  vals[14] = E3x3Seed / ESeed;
997  vals[15] = E5x5Seed / ESeed;
998  vals[16] = see;
999  vals[17] = spp;
1000  vals[18] = sep;
1001  vals[19] = EMaxSeed / ESeed;
1002  vals[20] = E2ndSeed / ESeed;
1003  vals[21] = ETopSeed / ESeed;
1004  vals[22] = EBottomSeed / ESeed;
1005  vals[23] = ELeftSeed / ESeed;
1006  vals[24] = ERightSeed / ESeed;
1007  vals[25] = E2x5MaxSeed / ESeed;
1008  vals[26] = E2x5TopSeed / ESeed;
1009  vals[27] = E2x5BottomSeed / ESeed;
1010  vals[28] = E2x5LeftSeed / ESeed;
1011  vals[29] = E2x5RightSeed / ESeed;
1012  vals[30] = IsEcalDriven;
1013  vals[31] = PreShowerOverRaw;
1014  }
1015 
1016  // Now evaluating the regression
1017  double regressionResult = 0;
1018  Int_t BinIndex = -1;
1019 
1020  if (fVersionType == kNoTrkVarV1) {
1021  if (std::abs(scEta) <= 1.479) {
1022  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1023  BinIndex = 0;
1024  } else {
1025  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1026  BinIndex = 1;
1027  }
1028  }
1029 
1030  //print debug
1031  if (printDebug) {
1032  if (std::abs(scEta) <= 1.479) {
1033  std::cout << "Barrel :";
1034  for (unsigned int v = 0; v < 39; ++v)
1035  std::cout << vals[v] << ", ";
1036  std::cout << "\n";
1037  } else {
1038  std::cout << "Endcap :";
1039  for (unsigned int v = 0; v < 32; ++v)
1040  std::cout << vals[v] << ", ";
1041  std::cout << "\n";
1042  }
1043  std::cout << "BinIndex : " << BinIndex << "\n";
1044  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1045  std::cout << "regression energy = " << regressionResult << std::endl;
1046  }
1047 
1048  // Cleaning up and returning
1049  delete[] vals;
1050  return regressionResult;
1051 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 3079 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithSubCluVar, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergy(), isInitialized(), and RegressionEnergyPatElectronProducer::produce().

3145  {
3146  // Checking if instance has been initialized
3147  if (fIsInitialized == kFALSE) {
3148  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
3149  return 0;
3150  }
3151 
3152  // Checking if type is correct
3153  if (!(fVersionType == kWithSubCluVar)) {
3154  std::cout << "Error: Regression VersionType " << fVersionType
3155  << " is not supported to use function regressionValueWithSubClusters.\n";
3156  return 0;
3157  }
3158 
3159  // Now applying regression according to version and (endcap/barrel)
3160  float *vals = (isEB) ? new float[61] : new float[65];
3161  if (isEB) { // Barrel
3162  vals[0] = rho;
3163  vals[1] = vertices;
3164  vals[2] = isEcalDriven;
3165  vals[3] = isEtaGap;
3166  vals[4] = isPhiGap;
3167  vals[5] = isDeeGap;
3168  vals[6] = SCRawEnergy;
3169  vals[7] = scEta;
3170  vals[8] = scPhi;
3171  vals[9] = R9;
3172  vals[10] = etawidth;
3173  vals[11] = phiwidth;
3174  vals[12] = NClusters;
3175  vals[13] = HoE;
3176  vals[14] = EtaSeed - scEta;
3177  vals[15] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
3178  vals[16] = ESeed / SCRawEnergy;
3179  vals[17] = E3x3Seed / ESeed;
3180  vals[18] = E5x5Seed / SCRawEnergy;
3181  vals[19] = E5x5Seed / ESeed;
3182  vals[20] = EMaxSeed / ESeed;
3183  vals[21] = E2ndSeed / ESeed;
3184  vals[22] = ETopSeed / ESeed;
3185  vals[23] = EBottomSeed / ESeed;
3186  vals[24] = ELeftSeed / ESeed;
3187  vals[25] = ERightSeed / ESeed;
3188  vals[26] = E2x5MaxSeed / ESeed;
3189  vals[27] = E2x5TopSeed / ESeed;
3190  vals[28] = E2x5BottomSeed / ESeed;
3191  vals[29] = E2x5LeftSeed / ESeed;
3192  vals[30] = E2x5RightSeed / ESeed;
3193  vals[31] = see;
3194  vals[32] = spp;
3195  vals[33] = sep;
3196  vals[34] = phiwidth / etawidth;
3197  vals[35] = (ELeftSeed + ERightSeed == 0. ? 0. : (ELeftSeed - ERightSeed) / (ELeftSeed + ERightSeed));
3198  vals[36] = (ETopSeed + EBottomSeed == 0. ? 0. : (ETopSeed - EBottomSeed) / (ETopSeed + EBottomSeed));
3199  vals[37] = ESubs / SCRawEnergy;
3200  vals[38] = ESub1 / SCRawEnergy;
3201  vals[39] = (NClusters <= 1 ? 999. : EtaSub1 - EtaSeed);
3202  vals[40] = (NClusters <= 1 ? 999. : atan2(sin(PhiSub1 - PhiSeed), cos(PhiSub1 - PhiSeed)));
3203  vals[41] = (NClusters <= 1 ? 0. : EMaxSub1 / ESub1);
3204  vals[42] = (NClusters <= 1 ? 0. : E3x3Sub1 / ESub1);
3205  vals[43] = ESub2 / SCRawEnergy;
3206  vals[44] = (NClusters <= 2 ? 999. : EtaSub2 - EtaSeed);
3207  vals[45] = (NClusters <= 2 ? 999. : atan2(sin(PhiSub2 - PhiSeed), cos(PhiSub2 - PhiSeed)));
3208  vals[46] = (NClusters <= 2 ? 0. : EMaxSub2 / ESub2);
3209  vals[47] = (NClusters <= 2 ? 0. : E3x3Sub2 / ESub2);
3210  vals[48] = ESub3 / SCRawEnergy;
3211  vals[49] = (NClusters <= 3 ? 999. : EtaSub3 - EtaSeed);
3212  vals[50] = (NClusters <= 3 ? 999. : atan2(sin(PhiSub3 - PhiSeed), cos(PhiSub3 - PhiSeed)));
3213  vals[51] = (NClusters <= 3 ? 0. : EMaxSub3 / ESub3);
3214  vals[52] = (NClusters <= 3 ? 0. : E3x3Sub3 / ESub3);
3215  vals[53] = IEtaSeed;
3216  vals[54] = ((int)IEtaSeed) % 5;
3217  vals[55] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
3218  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
3219  vals[56] = IPhiSeed;
3220  vals[57] = ((int)IPhiSeed) % 2;
3221  vals[58] = ((int)IPhiSeed) % 20;
3222  vals[59] = EtaCrySeed;
3223  vals[60] = PhiCrySeed;
3224  } else { // Endcap
3225  vals[0] = rho;
3226  vals[1] = vertices;
3227  vals[2] = isEcalDriven;
3228  vals[3] = isEtaGap;
3229  vals[4] = isPhiGap;
3230  vals[5] = isDeeGap;
3231  vals[6] = SCRawEnergy;
3232  vals[7] = scEta;
3233  vals[8] = scPhi;
3234  vals[9] = R9;
3235  vals[10] = etawidth;
3236  vals[11] = phiwidth;
3237  vals[12] = NClusters;
3238  vals[13] = HoE;
3239  vals[14] = EtaSeed - scEta;
3240  vals[15] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
3241  vals[16] = ESeed / SCRawEnergy;
3242  vals[17] = E3x3Seed / ESeed;
3243  vals[18] = E5x5Seed / SCRawEnergy;
3244  vals[19] = E5x5Seed / ESeed;
3245  vals[20] = EMaxSeed / ESeed;
3246  vals[21] = E2ndSeed / ESeed;
3247  vals[22] = ETopSeed / ESeed;
3248  vals[23] = EBottomSeed / ESeed;
3249  vals[24] = ELeftSeed / ESeed;
3250  vals[25] = ERightSeed / ESeed;
3251  vals[26] = E2x5MaxSeed / ESeed;
3252  vals[27] = E2x5TopSeed / ESeed;
3253  vals[28] = E2x5BottomSeed / ESeed;
3254  vals[29] = E2x5LeftSeed / ESeed;
3255  vals[30] = E2x5RightSeed / ESeed;
3256  vals[31] = see;
3257  vals[32] = spp;
3258  vals[33] = sep;
3259  vals[34] = phiwidth / etawidth;
3260  vals[35] = (ELeftSeed + ERightSeed == 0. ? 0. : (ELeftSeed - ERightSeed) / (ELeftSeed + ERightSeed));
3261  vals[36] = (ETopSeed + EBottomSeed == 0. ? 0. : (ETopSeed - EBottomSeed) / (ETopSeed + EBottomSeed));
3262  vals[37] = ESubs / SCRawEnergy;
3263  vals[38] = ESub1 / SCRawEnergy;
3264  vals[39] = (NClusters <= 1 ? 999. : EtaSub1 - EtaSeed);
3265  vals[40] = (NClusters <= 1 ? 999. : atan2(sin(PhiSub1 - PhiSeed), cos(PhiSub1 - PhiSeed)));
3266  vals[41] = (NClusters <= 1 ? 0. : EMaxSub1 / ESub1);
3267  vals[42] = (NClusters <= 1 ? 0. : E3x3Sub1 / ESub1);
3268  vals[43] = ESub2 / SCRawEnergy;
3269  vals[44] = (NClusters <= 2 ? 999. : EtaSub2 - EtaSeed);
3270  vals[45] = (NClusters <= 2 ? 999. : atan2(sin(PhiSub2 - PhiSeed), cos(PhiSub2 - PhiSeed)));
3271  vals[46] = (NClusters <= 2 ? 0. : EMaxSub2 / ESub2);
3272  vals[47] = (NClusters <= 2 ? 0. : E3x3Sub2 / ESub2);
3273  vals[48] = ESub3 / SCRawEnergy;
3274  vals[49] = (NClusters <= 3 ? 999. : EtaSub3 - EtaSeed);
3275  vals[50] = (NClusters <= 3 ? 999. : atan2(sin(PhiSub3 - PhiSeed), cos(PhiSub3 - PhiSeed)));
3276  vals[51] = (NClusters <= 3 ? 0. : EMaxSub3 / ESub3);
3277  vals[52] = (NClusters <= 3 ? 0. : E3x3Sub3 / ESub3);
3278  vals[53] = PreShowerOverRaw;
3279  vals[54] = NPshwClusters;
3280  vals[55] = EPshwSubs / SCRawEnergy;
3281  vals[56] = EPshwSub1 / SCRawEnergy;
3282  vals[57] = (NPshwClusters == 0 ? 999. : EtaPshwSub1 - EtaSeed);
3283  vals[58] = (NPshwClusters == 0 ? 999. : atan2(sin(PhiPshwSub1 - PhiSeed), cos(PhiPshwSub1 - PhiSeed)));
3284  vals[59] = EPshwSub2 / SCRawEnergy;
3285  vals[60] = (NPshwClusters <= 1 ? 999. : EtaPshwSub2 - EtaSeed);
3286  vals[61] = (NPshwClusters <= 1 ? 999. : atan2(sin(PhiPshwSub2 - PhiSeed), cos(PhiPshwSub2 - PhiSeed)));
3287  vals[62] = EPshwSub3 / SCRawEnergy;
3288  vals[63] = (NPshwClusters <= 2 ? 999. : EtaPshwSub3 - EtaSeed);
3289  vals[64] = (NPshwClusters <= 2 ? 999. : atan2(sin(PhiPshwSub3 - PhiSeed), cos(PhiPshwSub3 - PhiSeed)));
3290  }
3291 
3292  // Now evaluating the regression
3293  double regressionResult = 0;
3294  Int_t BinIndex = -1;
3295 
3296  if (fVersionType == kWithSubCluVar) {
3297  if (isEB) {
3298  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
3299  BinIndex = 0;
3300  } else {
3301  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
3302  BinIndex = 1;
3303  }
3304  }
3305 
3306  //print debug
3307  if (printDebug) {
3308  if (isEB) {
3309  std::cout << "Barrel :";
3310  for (unsigned int v = 0; v < 61; ++v)
3311  std::cout << v << "=" << vals[v] << ", ";
3312  std::cout << "\n";
3313  } else {
3314  std::cout << "Endcap :";
3315  for (unsigned int v = 0; v < 65; ++v)
3316  std::cout << v << "=" << vals[v] << ", ";
3317  std::cout << "\n";
3318  }
3319  std::cout << "BinIndex : " << BinIndex << "\n";
3320  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
3321  std::cout << "regression energy = " << regressionResult << std::endl;
3322  }
3323 
3324  // Cleaning up and returning
3325  delete[] vals;
3326  return regressionResult;
3327 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 1219 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVar, DiDispStaMuonMonitor_cfi::pt, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by isInitialized(), and RegressionEnergyPatElectronProducer::produce().

1259  {
1260  // Checking if instance has been initialized
1261  if (fIsInitialized == kFALSE) {
1262  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1263  return 0;
1264  }
1265 
1266  // Checking if fVersionType is correct
1267  assert(fVersionType == kWithTrkVar);
1268 
1269  float *vals = (std::abs(scEta) <= 1.479) ? new float[43] : new float[36];
1270  if (std::abs(scEta) <= 1.479) { // Barrel
1271  vals[0] = SCRawEnergy;
1272  vals[1] = scEta;
1273  vals[2] = scPhi;
1274  vals[3] = R9;
1275  vals[4] = E5x5Seed / SCRawEnergy;
1276  vals[5] = etawidth;
1277  vals[6] = phiwidth;
1278  vals[7] = NClusters;
1279  vals[8] = HoE;
1280  vals[9] = rho;
1281  vals[10] = vertices;
1282  vals[11] = EtaSeed - scEta;
1283  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1284  vals[13] = ESeed / SCRawEnergy;
1285  vals[14] = E3x3Seed / ESeed;
1286  vals[15] = E5x5Seed / ESeed;
1287  vals[16] = see;
1288  vals[17] = spp;
1289  vals[18] = sep;
1290  vals[19] = EMaxSeed / ESeed;
1291  vals[20] = E2ndSeed / ESeed;
1292  vals[21] = ETopSeed / ESeed;
1293  vals[22] = EBottomSeed / ESeed;
1294  vals[23] = ELeftSeed / ESeed;
1295  vals[24] = ERightSeed / ESeed;
1296  vals[25] = E2x5MaxSeed / ESeed;
1297  vals[26] = E2x5TopSeed / ESeed;
1298  vals[27] = E2x5BottomSeed / ESeed;
1299  vals[28] = E2x5LeftSeed / ESeed;
1300  vals[29] = E2x5RightSeed / ESeed;
1301  vals[30] = pt;
1302  vals[31] = GsfTrackPIn;
1303  vals[32] = fbrem;
1304  vals[33] = Charge;
1305  vals[34] = EoP;
1306  vals[35] = IEtaSeed;
1307  vals[36] = IPhiSeed;
1308  vals[37] = ((int)IEtaSeed) % 5;
1309  vals[38] = ((int)IPhiSeed) % 2;
1310  vals[39] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
1311  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
1312  vals[40] = ((int)IPhiSeed) % 20;
1313  vals[41] = EtaCrySeed;
1314  vals[42] = PhiCrySeed;
1315  }
1316 
1317  else { // Endcap
1318  vals[0] = SCRawEnergy;
1319  vals[1] = scEta;
1320  vals[2] = scPhi;
1321  vals[3] = R9;
1322  vals[4] = E5x5Seed / SCRawEnergy;
1323  vals[5] = etawidth;
1324  vals[6] = phiwidth;
1325  vals[7] = NClusters;
1326  vals[8] = HoE;
1327  vals[9] = rho;
1328  vals[10] = vertices;
1329  vals[11] = EtaSeed - scEta;
1330  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1331  vals[13] = ESeed / SCRawEnergy;
1332  vals[14] = E3x3Seed / ESeed;
1333  vals[15] = E5x5Seed / ESeed;
1334  vals[16] = see;
1335  vals[17] = spp;
1336  vals[18] = sep;
1337  vals[19] = EMaxSeed / ESeed;
1338  vals[20] = E2ndSeed / ESeed;
1339  vals[21] = ETopSeed / ESeed;
1340  vals[22] = EBottomSeed / ESeed;
1341  vals[23] = ELeftSeed / ESeed;
1342  vals[24] = ERightSeed / ESeed;
1343  vals[25] = E2x5MaxSeed / ESeed;
1344  vals[26] = E2x5TopSeed / ESeed;
1345  vals[27] = E2x5BottomSeed / ESeed;
1346  vals[28] = E2x5LeftSeed / ESeed;
1347  vals[29] = E2x5RightSeed / ESeed;
1348  vals[30] = pt;
1349  vals[31] = GsfTrackPIn;
1350  vals[32] = fbrem;
1351  vals[33] = Charge;
1352  vals[34] = EoP;
1353  vals[35] = PreShowerOverRaw;
1354  }
1355 
1356  // Now evaluating the regression
1357  double regressionResult = 0;
1358 
1359  if (fVersionType == kWithTrkVar) {
1360  if (std::abs(scEta) <= 1.479)
1361  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1362  else
1363  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1364  }
1365 
1366  //print debug
1367  if (printDebug) {
1368  if (scEta <= 1.479) {
1369  std::cout << "Barrel :";
1370  for (unsigned int v = 0; v < 43; ++v)
1371  std::cout << vals[v] << ", ";
1372  std::cout << "\n";
1373  } else {
1374  std::cout << "Endcap :";
1375  for (unsigned int v = 0; v < 36; ++v)
1376  std::cout << vals[v] << ", ";
1377  std::cout << "\n";
1378  }
1379  std::cout << "pt = " << pt << " : SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw
1380  << std::endl;
1381  std::cout << "regression energy = " << regressionResult << std::endl;
1382  }
1383 
1384  // Cleaning up and returning
1385  delete[] vals;
1386  return regressionResult;
1387 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 1561 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergy(), and isInitialized().

1603  {
1604  // Checking if instance has been initialized
1605  if (fIsInitialized == kFALSE) {
1606  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1607  return 0;
1608  }
1609 
1610  // Checking if fVersionType is correct
1611  assert(fVersionType == kWithTrkVarV1);
1612 
1613  float *vals = (std::abs(scEta) <= 1.479) ? new float[46] : new float[39];
1614  if (std::abs(scEta) <= 1.479) { // Barrel
1615  vals[0] = SCRawEnergy;
1616  vals[1] = scEta;
1617  vals[2] = scPhi;
1618  vals[3] = R9;
1619  vals[4] = E5x5Seed / SCRawEnergy;
1620  vals[5] = etawidth;
1621  vals[6] = phiwidth;
1622  vals[7] = NClusters;
1623  vals[8] = HoE;
1624  vals[9] = rho;
1625  vals[10] = vertices;
1626  vals[11] = EtaSeed - scEta;
1627  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1628  vals[13] = ESeed / SCRawEnergy;
1629  vals[14] = E3x3Seed / ESeed;
1630  vals[15] = E5x5Seed / ESeed;
1631  vals[16] = see;
1632  vals[17] = spp;
1633  vals[18] = sep;
1634  vals[19] = EMaxSeed / ESeed;
1635  vals[20] = E2ndSeed / ESeed;
1636  vals[21] = ETopSeed / ESeed;
1637  vals[22] = EBottomSeed / ESeed;
1638  vals[23] = ELeftSeed / ESeed;
1639  vals[24] = ERightSeed / ESeed;
1640  vals[25] = E2x5MaxSeed / ESeed;
1641  vals[26] = E2x5TopSeed / ESeed;
1642  vals[27] = E2x5BottomSeed / ESeed;
1643  vals[28] = E2x5LeftSeed / ESeed;
1644  vals[29] = E2x5RightSeed / ESeed;
1645  vals[30] = IsEcalDriven;
1646  vals[31] = GsfTrackPIn;
1647  vals[32] = fbrem;
1648  vals[33] = Charge;
1649  vals[34] = EoP;
1650  vals[35] = TrackMomentumError / GsfTrackPIn;
1651  vals[36] = EcalEnergyError / SCRawEnergy;
1652  vals[37] = Classification;
1653  vals[38] = IEtaSeed;
1654  vals[39] = IPhiSeed;
1655  vals[40] = ((int)IEtaSeed) % 5;
1656  vals[41] = ((int)IPhiSeed) % 2;
1657  vals[42] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
1658  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
1659  vals[43] = ((int)IPhiSeed) % 20;
1660  vals[44] = EtaCrySeed;
1661  vals[45] = PhiCrySeed;
1662  }
1663 
1664  else { // Endcap
1665  vals[0] = SCRawEnergy;
1666  vals[1] = scEta;
1667  vals[2] = scPhi;
1668  vals[3] = R9;
1669  vals[4] = E5x5Seed / SCRawEnergy;
1670  vals[5] = etawidth;
1671  vals[6] = phiwidth;
1672  vals[7] = NClusters;
1673  vals[8] = HoE;
1674  vals[9] = rho;
1675  vals[10] = vertices;
1676  vals[11] = EtaSeed - scEta;
1677  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1678  vals[13] = ESeed / SCRawEnergy;
1679  vals[14] = E3x3Seed / ESeed;
1680  vals[15] = E5x5Seed / ESeed;
1681  vals[16] = see;
1682  vals[17] = spp;
1683  vals[18] = sep;
1684  vals[19] = EMaxSeed / ESeed;
1685  vals[20] = E2ndSeed / ESeed;
1686  vals[21] = ETopSeed / ESeed;
1687  vals[22] = EBottomSeed / ESeed;
1688  vals[23] = ELeftSeed / ESeed;
1689  vals[24] = ERightSeed / ESeed;
1690  vals[25] = E2x5MaxSeed / ESeed;
1691  vals[26] = E2x5TopSeed / ESeed;
1692  vals[27] = E2x5BottomSeed / ESeed;
1693  vals[28] = E2x5LeftSeed / ESeed;
1694  vals[29] = E2x5RightSeed / ESeed;
1695  vals[30] = IsEcalDriven;
1696  vals[31] = GsfTrackPIn;
1697  vals[32] = fbrem;
1698  vals[33] = Charge;
1699  vals[34] = EoP;
1700  vals[35] = TrackMomentumError / GsfTrackPIn;
1701  vals[36] = EcalEnergyError / SCRawEnergy;
1702  vals[37] = Classification;
1703  vals[38] = PreShowerOverRaw;
1704  }
1705 
1706  // Now evaluating the regression
1707  double regressionResult = 0;
1708 
1709  if (fVersionType == kWithTrkVarV1) {
1710  if (std::abs(scEta) <= 1.479)
1711  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
1712  else
1713  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
1714  }
1715 
1716  //print debug
1717  if (printDebug) {
1718  if (std::abs(scEta) <= 1.479) {
1719  std::cout << "Barrel :";
1720  for (unsigned int v = 0; v < 46; ++v)
1721  std::cout << vals[v] << ", ";
1722  std::cout << "\n";
1723  } else {
1724  std::cout << "Endcap :";
1725  for (unsigned int v = 0; v < 39; ++v)
1726  std::cout << vals[v] << ", ";
1727  std::cout << "\n";
1728  }
1729  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
1730  std::cout << "regression energy = " << regressionResult << std::endl;
1731  }
1732 
1733  // Cleaning up and returning
1734  delete[] vals;
1735  return regressionResult;
1736 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV1 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 1915 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV1, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

1915  {
1916  // Checking if instance has been initialized
1917  if (fIsInitialized == kFALSE) {
1918  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
1919  return 0;
1920  }
1921 
1922  // Checking if fVersionType is correct
1923  assert(fVersionType == kWithTrkVarV1);
1924 
1925  // Checking if fVersionType is correct
1926  assert(inputvars.size() == 42);
1927 
1928  double SCRawEnergy = inputvars[0];
1929  double scEta = inputvars[1];
1930  double scPhi = inputvars[2];
1931  double R9 = inputvars[3];
1932  double etawidth = inputvars[4];
1933  double phiwidth = inputvars[5];
1934  double NClusters = inputvars[6];
1935  double HoE = inputvars[7];
1936  double rho = inputvars[8];
1937  double vertices = inputvars[9];
1938  double EtaSeed = inputvars[10];
1939  double PhiSeed = inputvars[11];
1940  double ESeed = inputvars[12];
1941  double E3x3Seed = inputvars[13];
1942  double E5x5Seed = inputvars[14];
1943  double see = inputvars[15];
1944  double spp = inputvars[16];
1945  double sep = inputvars[17];
1946  double EMaxSeed = inputvars[18];
1947  double E2ndSeed = inputvars[19];
1948  double ETopSeed = inputvars[20];
1949  double EBottomSeed = inputvars[21];
1950  double ELeftSeed = inputvars[22];
1951  double ERightSeed = inputvars[23];
1952  double E2x5MaxSeed = inputvars[24];
1953  double E2x5TopSeed = inputvars[25];
1954  double E2x5BottomSeed = inputvars[26];
1955  double E2x5LeftSeed = inputvars[27];
1956  double E2x5RightSeed = inputvars[28];
1957  double IEtaSeed = inputvars[29];
1958  double IPhiSeed = inputvars[30];
1959  double EtaCrySeed = inputvars[31];
1960  double PhiCrySeed = inputvars[32];
1961  double PreShowerOverRaw = inputvars[33];
1962  int IsEcalDriven = inputvars[34];
1963  double GsfTrackPIn = inputvars[35];
1964  double fbrem = inputvars[36];
1965  double Charge = inputvars[37];
1966  double EoP = inputvars[38];
1967  double TrackMomentumError = inputvars[39];
1968  double EcalEnergyError = inputvars[40];
1969  int Classification = inputvars[41];
1970 
1971  float *vals = (std::abs(scEta) <= 1.479) ? new float[46] : new float[39];
1972  if (std::abs(scEta) <= 1.479) { // Barrel
1973  vals[0] = SCRawEnergy;
1974  vals[1] = scEta;
1975  vals[2] = scPhi;
1976  vals[3] = R9;
1977  vals[4] = E5x5Seed / SCRawEnergy;
1978  vals[5] = etawidth;
1979  vals[6] = phiwidth;
1980  vals[7] = NClusters;
1981  vals[8] = HoE;
1982  vals[9] = rho;
1983  vals[10] = vertices;
1984  vals[11] = EtaSeed - scEta;
1985  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
1986  vals[13] = ESeed / SCRawEnergy;
1987  vals[14] = E3x3Seed / ESeed;
1988  vals[15] = E5x5Seed / ESeed;
1989  vals[16] = see;
1990  vals[17] = spp;
1991  vals[18] = sep;
1992  vals[19] = EMaxSeed / ESeed;
1993  vals[20] = E2ndSeed / ESeed;
1994  vals[21] = ETopSeed / ESeed;
1995  vals[22] = EBottomSeed / ESeed;
1996  vals[23] = ELeftSeed / ESeed;
1997  vals[24] = ERightSeed / ESeed;
1998  vals[25] = E2x5MaxSeed / ESeed;
1999  vals[26] = E2x5TopSeed / ESeed;
2000  vals[27] = E2x5BottomSeed / ESeed;
2001  vals[28] = E2x5LeftSeed / ESeed;
2002  vals[29] = E2x5RightSeed / ESeed;
2003  vals[30] = IsEcalDriven;
2004  vals[31] = GsfTrackPIn;
2005  vals[32] = fbrem;
2006  vals[33] = Charge;
2007  vals[34] = EoP;
2008  vals[35] = TrackMomentumError / GsfTrackPIn;
2009  vals[36] = EcalEnergyError / SCRawEnergy;
2010  vals[37] = Classification;
2011  vals[38] = IEtaSeed;
2012  vals[39] = IPhiSeed;
2013  vals[40] = ((int)IEtaSeed) % 5;
2014  vals[41] = ((int)IPhiSeed) % 2;
2015  vals[42] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2016  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2017  vals[43] = ((int)IPhiSeed) % 20;
2018  vals[44] = EtaCrySeed;
2019  vals[45] = PhiCrySeed;
2020  }
2021 
2022  else { // Endcap
2023  vals[0] = SCRawEnergy;
2024  vals[1] = scEta;
2025  vals[2] = scPhi;
2026  vals[3] = R9;
2027  vals[4] = E5x5Seed / SCRawEnergy;
2028  vals[5] = etawidth;
2029  vals[6] = phiwidth;
2030  vals[7] = NClusters;
2031  vals[8] = HoE;
2032  vals[9] = rho;
2033  vals[10] = vertices;
2034  vals[11] = EtaSeed - scEta;
2035  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2036  vals[13] = ESeed / SCRawEnergy;
2037  vals[14] = E3x3Seed / ESeed;
2038  vals[15] = E5x5Seed / ESeed;
2039  vals[16] = see;
2040  vals[17] = spp;
2041  vals[18] = sep;
2042  vals[19] = EMaxSeed / ESeed;
2043  vals[20] = E2ndSeed / ESeed;
2044  vals[21] = ETopSeed / ESeed;
2045  vals[22] = EBottomSeed / ESeed;
2046  vals[23] = ELeftSeed / ESeed;
2047  vals[24] = ERightSeed / ESeed;
2048  vals[25] = E2x5MaxSeed / ESeed;
2049  vals[26] = E2x5TopSeed / ESeed;
2050  vals[27] = E2x5BottomSeed / ESeed;
2051  vals[28] = E2x5LeftSeed / ESeed;
2052  vals[29] = E2x5RightSeed / ESeed;
2053  vals[30] = IsEcalDriven;
2054  vals[31] = GsfTrackPIn;
2055  vals[32] = fbrem;
2056  vals[33] = Charge;
2057  vals[34] = EoP;
2058  vals[35] = TrackMomentumError / GsfTrackPIn;
2059  vals[36] = EcalEnergyError / SCRawEnergy;
2060  vals[37] = Classification;
2061  vals[38] = PreShowerOverRaw;
2062  }
2063 
2064  // Now evaluating the regression
2065  double regressionResult = 0;
2066 
2067  if (fVersionType == kWithTrkVarV1) {
2068  if (std::abs(scEta) <= 1.479)
2069  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2070  else
2071  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2072  }
2073 
2074  //print debug
2075  if (printDebug) {
2076  if (std::abs(scEta) <= 1.479) {
2077  std::cout << "Barrel :";
2078  for (unsigned int v = 0; v < 46; ++v)
2079  std::cout << vals[v] << ", ";
2080  std::cout << "\n";
2081  } else {
2082  std::cout << "Endcap :";
2083  for (unsigned int v = 0; v < 39; ++v)
2084  std::cout << vals[v] << ", ";
2085  std::cout << "\n";
2086  }
2087  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2088  std::cout << "regression energy = " << regressionResult << std::endl;
2089  }
2090 
2091  // Cleaning up and returning
2092  delete[] vals;
2093  return regressionResult;
2094 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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 2278 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

Referenced by calculateRegressionEnergy(), and isInitialized().

2327  {
2328  // Checking if instance has been initialized
2329  if (fIsInitialized == kFALSE) {
2330  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2331  return 0;
2332  }
2333 
2334  // Checking if fVersionType is correct
2335  assert(fVersionType == kWithTrkVarV2);
2336 
2337  float *vals = (std::abs(scEta) <= 1.479) ? new float[53] : new float[46];
2338  if (std::abs(scEta) <= 1.479) { // Barrel
2339  vals[0] = SCRawEnergy;
2340  vals[1] = scEta;
2341  vals[2] = scPhi;
2342  vals[3] = R9;
2343  vals[4] = E5x5Seed / SCRawEnergy;
2344  vals[5] = etawidth;
2345  vals[6] = phiwidth;
2346  vals[7] = NClusters;
2347  vals[8] = HoE;
2348  vals[9] = rho;
2349  vals[10] = vertices;
2350  vals[11] = EtaSeed - scEta;
2351  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2352  vals[13] = ESeed / SCRawEnergy;
2353  vals[14] = E3x3Seed / ESeed;
2354  vals[15] = E5x5Seed / ESeed;
2355  vals[16] = see;
2356  vals[17] = spp;
2357  vals[18] = sep;
2358  vals[19] = EMaxSeed / ESeed;
2359  vals[20] = E2ndSeed / ESeed;
2360  vals[21] = ETopSeed / ESeed;
2361  vals[22] = EBottomSeed / ESeed;
2362  vals[23] = ELeftSeed / ESeed;
2363  vals[24] = ERightSeed / ESeed;
2364  vals[25] = E2x5MaxSeed / ESeed;
2365  vals[26] = E2x5TopSeed / ESeed;
2366  vals[27] = E2x5BottomSeed / ESeed;
2367  vals[28] = E2x5LeftSeed / ESeed;
2368  vals[29] = E2x5RightSeed / ESeed;
2369  vals[30] = IsEcalDriven;
2370  vals[31] = GsfTrackPIn;
2371  vals[32] = fbrem;
2372  vals[33] = Charge;
2373  vals[34] = EoP;
2374  vals[35] = TrackMomentumError / GsfTrackPIn;
2375  vals[36] = EcalEnergyError / SCRawEnergy;
2376  vals[37] = Classification;
2377  vals[38] = detaIn;
2378  vals[39] = dphiIn;
2379  vals[40] = detaCalo;
2380  vals[41] = dphiCalo;
2381  vals[42] = GsfTrackChiSqr;
2382  vals[43] = KFTrackNLayers;
2383  vals[44] = ElectronEnergyOverPout;
2384  vals[45] = IEtaSeed;
2385  vals[46] = IPhiSeed;
2386  vals[47] = ((int)IEtaSeed) % 5;
2387  vals[48] = ((int)IPhiSeed) % 2;
2388  vals[49] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2389  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2390  vals[50] = ((int)IPhiSeed) % 20;
2391  vals[51] = EtaCrySeed;
2392  vals[52] = PhiCrySeed;
2393  }
2394 
2395  else { // Endcap
2396  vals[0] = SCRawEnergy;
2397  vals[1] = scEta;
2398  vals[2] = scPhi;
2399  vals[3] = R9;
2400  vals[4] = E5x5Seed / SCRawEnergy;
2401  vals[5] = etawidth;
2402  vals[6] = phiwidth;
2403  vals[7] = NClusters;
2404  vals[8] = HoE;
2405  vals[9] = rho;
2406  vals[10] = vertices;
2407  vals[11] = EtaSeed - scEta;
2408  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2409  vals[13] = ESeed / SCRawEnergy;
2410  vals[14] = E3x3Seed / ESeed;
2411  vals[15] = E5x5Seed / ESeed;
2412  vals[16] = see;
2413  vals[17] = spp;
2414  vals[18] = sep;
2415  vals[19] = EMaxSeed / ESeed;
2416  vals[20] = E2ndSeed / ESeed;
2417  vals[21] = ETopSeed / ESeed;
2418  vals[22] = EBottomSeed / ESeed;
2419  vals[23] = ELeftSeed / ESeed;
2420  vals[24] = ERightSeed / ESeed;
2421  vals[25] = E2x5MaxSeed / ESeed;
2422  vals[26] = E2x5TopSeed / ESeed;
2423  vals[27] = E2x5BottomSeed / ESeed;
2424  vals[28] = E2x5LeftSeed / ESeed;
2425  vals[29] = E2x5RightSeed / ESeed;
2426  vals[30] = IsEcalDriven;
2427  vals[31] = GsfTrackPIn;
2428  vals[32] = fbrem;
2429  vals[33] = Charge;
2430  vals[34] = EoP;
2431  vals[35] = TrackMomentumError / GsfTrackPIn;
2432  vals[36] = EcalEnergyError / SCRawEnergy;
2433  vals[37] = Classification;
2434  vals[38] = detaIn;
2435  vals[39] = dphiIn;
2436  vals[40] = detaCalo;
2437  vals[41] = dphiCalo;
2438  vals[42] = GsfTrackChiSqr;
2439  vals[43] = KFTrackNLayers;
2440  vals[44] = ElectronEnergyOverPout;
2441  vals[45] = PreShowerOverRaw;
2442  }
2443 
2444  // Now evaluating the regression
2445  double regressionResult = 0;
2446 
2447  if (fVersionType == kWithTrkVarV2) {
2448  if (std::abs(scEta) <= 1.479)
2449  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2450  else
2451  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2452  }
2453 
2454  //print debug
2455  if (printDebug) {
2456  if (std::abs(scEta) <= 1.479) {
2457  std::cout << "Barrel :";
2458  for (unsigned int v = 0; v < 53; ++v)
2459  std::cout << vals[v] << ", ";
2460  std::cout << "\n";
2461  } else {
2462  std::cout << "Endcap :";
2463  for (unsigned int v = 0; v < 46; ++v)
2464  std::cout << vals[v] << ", ";
2465  std::cout << "\n";
2466  }
2467  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2468  std::cout << "regression energy = " << regressionResult << std::endl;
2469  }
2470 
2471  // Cleaning up and returning
2472  delete[] vals;
2473  return regressionResult;
2474 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double ElectronEnergyRegressionEvaluate::regressionValueWithTrkVarV2 ( std::vector< double > &  inputvars,
bool  printDebug = false 
)

Definition at line 2674 of file ElectronEnergyRegressionEvaluate.cc.

References funct::abs(), funct::cos(), gather_cfg::cout, fIsInitialized, forestCorrection_eb, forestCorrection_ee, fVersionType, GBRForest::GetResponse(), createfilelist::int, kWithTrkVarV2, rho, funct::sin(), findQualityFiles::v, and pwdgSkimBPark_cfi::vertices.

2674  {
2675  // Checking if instance has been initialized
2676  if (fIsInitialized == kFALSE) {
2677  printf("ElectronEnergyRegressionEvaluate instance not initialized !!!");
2678  return 0;
2679  }
2680 
2681  // Checking if fVersionType is correct
2682  assert(fVersionType == kWithTrkVarV2);
2683 
2684  // Checking if fVersionType is correct
2685  assert(inputvars.size() == 49);
2686 
2687  double SCRawEnergy = inputvars[0];
2688  double scEta = inputvars[1];
2689  double scPhi = inputvars[2];
2690  double R9 = inputvars[3];
2691  double etawidth = inputvars[4];
2692  double phiwidth = inputvars[5];
2693  double NClusters = inputvars[6];
2694  double HoE = inputvars[7];
2695  double rho = inputvars[8];
2696  double vertices = inputvars[9];
2697  double EtaSeed = inputvars[10];
2698  double PhiSeed = inputvars[11];
2699  double ESeed = inputvars[12];
2700  double E3x3Seed = inputvars[13];
2701  double E5x5Seed = inputvars[14];
2702  double see = inputvars[15];
2703  double spp = inputvars[16];
2704  double sep = inputvars[17];
2705  double EMaxSeed = inputvars[18];
2706  double E2ndSeed = inputvars[19];
2707  double ETopSeed = inputvars[20];
2708  double EBottomSeed = inputvars[21];
2709  double ELeftSeed = inputvars[22];
2710  double ERightSeed = inputvars[23];
2711  double E2x5MaxSeed = inputvars[24];
2712  double E2x5TopSeed = inputvars[25];
2713  double E2x5BottomSeed = inputvars[26];
2714  double E2x5LeftSeed = inputvars[27];
2715  double E2x5RightSeed = inputvars[28];
2716  double IEtaSeed = inputvars[29];
2717  double IPhiSeed = inputvars[30];
2718  double EtaCrySeed = inputvars[31];
2719  double PhiCrySeed = inputvars[32];
2720  double PreShowerOverRaw = inputvars[33];
2721  int IsEcalDriven = inputvars[34];
2722  double GsfTrackPIn = inputvars[35];
2723  double fbrem = inputvars[36];
2724  double Charge = inputvars[37];
2725  double EoP = inputvars[38];
2726  double TrackMomentumError = inputvars[39];
2727  double EcalEnergyError = inputvars[40];
2728  int Classification = inputvars[41];
2729  double detaIn = inputvars[42];
2730  double dphiIn = inputvars[43];
2731  double detaCalo = inputvars[44];
2732  double dphiCalo = inputvars[45];
2733  double GsfTrackChiSqr = inputvars[46];
2734  double KFTrackNLayers = inputvars[47];
2735  double ElectronEnergyOverPout = inputvars[48];
2736 
2737  float *vals = (std::abs(scEta) <= 1.479) ? new float[53] : new float[46];
2738  if (std::abs(scEta) <= 1.479) { // Barrel
2739  vals[0] = SCRawEnergy;
2740  vals[1] = scEta;
2741  vals[2] = scPhi;
2742  vals[3] = R9;
2743  vals[4] = E5x5Seed / SCRawEnergy;
2744  vals[5] = etawidth;
2745  vals[6] = phiwidth;
2746  vals[7] = NClusters;
2747  vals[8] = HoE;
2748  vals[9] = rho;
2749  vals[10] = vertices;
2750  vals[11] = EtaSeed - scEta;
2751  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2752  vals[13] = ESeed / SCRawEnergy;
2753  vals[14] = E3x3Seed / ESeed;
2754  vals[15] = E5x5Seed / ESeed;
2755  vals[16] = see;
2756  vals[17] = spp;
2757  vals[18] = sep;
2758  vals[19] = EMaxSeed / ESeed;
2759  vals[20] = E2ndSeed / ESeed;
2760  vals[21] = ETopSeed / ESeed;
2761  vals[22] = EBottomSeed / ESeed;
2762  vals[23] = ELeftSeed / ESeed;
2763  vals[24] = ERightSeed / ESeed;
2764  vals[25] = E2x5MaxSeed / ESeed;
2765  vals[26] = E2x5TopSeed / ESeed;
2766  vals[27] = E2x5BottomSeed / ESeed;
2767  vals[28] = E2x5LeftSeed / ESeed;
2768  vals[29] = E2x5RightSeed / ESeed;
2769  vals[30] = IsEcalDriven;
2770  vals[31] = GsfTrackPIn;
2771  vals[32] = fbrem;
2772  vals[33] = Charge;
2773  vals[34] = EoP;
2774  vals[35] = TrackMomentumError / GsfTrackPIn;
2775  vals[36] = EcalEnergyError / SCRawEnergy;
2776  vals[37] = Classification;
2777  vals[38] = detaIn;
2778  vals[39] = dphiIn;
2779  vals[40] = detaCalo;
2780  vals[41] = dphiCalo;
2781  vals[42] = GsfTrackChiSqr;
2782  vals[43] = KFTrackNLayers;
2783  vals[44] = ElectronEnergyOverPout;
2784  vals[45] = IEtaSeed;
2785  vals[46] = IPhiSeed;
2786  vals[47] = ((int)IEtaSeed) % 5;
2787  vals[48] = ((int)IPhiSeed) % 2;
2788  vals[49] = (std::abs(IEtaSeed) <= 25) * (((int)IEtaSeed) % 25) +
2789  (std::abs(IEtaSeed) > 25) * (((int)(IEtaSeed - 25 * std::abs(IEtaSeed) / IEtaSeed)) % 20);
2790  vals[50] = ((int)IPhiSeed) % 20;
2791  vals[51] = EtaCrySeed;
2792  vals[52] = PhiCrySeed;
2793  }
2794 
2795  else { // Endcap
2796  vals[0] = SCRawEnergy;
2797  vals[1] = scEta;
2798  vals[2] = scPhi;
2799  vals[3] = R9;
2800  vals[4] = E5x5Seed / SCRawEnergy;
2801  vals[5] = etawidth;
2802  vals[6] = phiwidth;
2803  vals[7] = NClusters;
2804  vals[8] = HoE;
2805  vals[9] = rho;
2806  vals[10] = vertices;
2807  vals[11] = EtaSeed - scEta;
2808  vals[12] = atan2(sin(PhiSeed - scPhi), cos(PhiSeed - scPhi));
2809  vals[13] = ESeed / SCRawEnergy;
2810  vals[14] = E3x3Seed / ESeed;
2811  vals[15] = E5x5Seed / ESeed;
2812  vals[16] = see;
2813  vals[17] = spp;
2814  vals[18] = sep;
2815  vals[19] = EMaxSeed / ESeed;
2816  vals[20] = E2ndSeed / ESeed;
2817  vals[21] = ETopSeed / ESeed;
2818  vals[22] = EBottomSeed / ESeed;
2819  vals[23] = ELeftSeed / ESeed;
2820  vals[24] = ERightSeed / ESeed;
2821  vals[25] = E2x5MaxSeed / ESeed;
2822  vals[26] = E2x5TopSeed / ESeed;
2823  vals[27] = E2x5BottomSeed / ESeed;
2824  vals[28] = E2x5LeftSeed / ESeed;
2825  vals[29] = E2x5RightSeed / ESeed;
2826  vals[30] = IsEcalDriven;
2827  vals[31] = GsfTrackPIn;
2828  vals[32] = fbrem;
2829  vals[33] = Charge;
2830  vals[34] = EoP;
2831  vals[35] = TrackMomentumError / GsfTrackPIn;
2832  vals[36] = EcalEnergyError / SCRawEnergy;
2833  vals[37] = Classification;
2834  vals[38] = detaIn;
2835  vals[39] = dphiIn;
2836  vals[40] = detaCalo;
2837  vals[41] = dphiCalo;
2838  vals[42] = GsfTrackChiSqr;
2839  vals[43] = KFTrackNLayers;
2840  vals[44] = ElectronEnergyOverPout;
2841  vals[45] = PreShowerOverRaw;
2842  }
2843 
2844  // Now evaluating the regression
2845  double regressionResult = 0;
2846 
2847  if (fVersionType == kWithTrkVarV2) {
2848  if (std::abs(scEta) <= 1.479)
2849  regressionResult = SCRawEnergy * forestCorrection_eb->GetResponse(vals);
2850  else
2851  regressionResult = (SCRawEnergy * (1 + PreShowerOverRaw)) * forestCorrection_ee->GetResponse(vals);
2852  }
2853 
2854  //print debug
2855  if (printDebug) {
2856  if (std::abs(scEta) <= 1.479) {
2857  std::cout << "Barrel :";
2858  for (unsigned int v = 0; v < 53; ++v)
2859  std::cout << vals[v] << ", ";
2860  std::cout << "\n";
2861  } else {
2862  std::cout << "Endcap :";
2863  for (unsigned int v = 0; v < 46; ++v)
2864  std::cout << vals[v] << ", ";
2865  std::cout << "\n";
2866  }
2867  std::cout << "SCRawEnergy = " << SCRawEnergy << " : PreShowerOverRaw = " << PreShowerOverRaw << std::endl;
2868  std::cout << "regression energy = " << regressionResult << std::endl;
2869  }
2870 
2871  // Cleaning up and returning
2872  delete[] vals;
2873  return regressionResult;
2874 }
double GetResponse(const float *vector) const
Definition: GBRForest.h:49
ElectronEnergyRegressionEvaluate::ElectronEnergyRegressionType fVersionType
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

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