CMS 3D CMS Logo

Namespaces | Classes | Enumerations | Functions
egamma Namespace Reference

Namespaces

 conv
 

Classes

struct  ElectronMomentum
 

Enumerations

enum  HoeMode { HoeMode::SingleTower = 0, HoeMode::TowersBehindCluster = 1 }
 

Functions

float classBasedElectronEnergy (reco::GsfElectron const &, reco::BeamSpot const &, EcalClusterFunctionBaseClass const &crackCorrectionFunction)
 
double classBasedElectronEnergyUncertainty (reco::GsfElectron const &)
 
reco::GsfElectron::Classification classifyElectron (reco::GsfElectron const &)
 
ElectronMomentum correctElectronMomentum (reco::GsfElectron const &, TrajectoryStateOnSurface const &)
 
double depth1HcalESum (std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
 
double depth2HcalESum (std::vector< CaloTowerDetId > const &towers, CaloTowerCollection const &)
 
float ecalClusterEnergyUncertaintyElectronSpecific (reco::SuperCluster const &superCluster)
 
double electronEnergyUncertainty (reco::GsfElectron::Classification c, double eta, double brem, double energy)
 
std::pair< reco::TrackRef, float > getClosestCtfToGsf (reco::GsfTrackRef const &, edm::Handle< reco::TrackCollection > const &ctfTracksH, edm::soa::EtaPhiTableView trackEtaPhiTable)
 
template<typename T >
uint32_t getRandomSeedFromObj (const edm::Event &iEvent, const T &obj, size_t nrObjs, size_t objNr)
 
uint32_t getRandomSeedFromSC (const edm::Event &iEvent, const reco::SuperClusterRef scRef)
 
bool hasActiveHcal (std::vector< CaloTowerDetId > const &towers, CaloTowerConstituentsMap const &towerMap, HcalChannelQuality const &hcalQuality, HcalTopology const &hcalTopology)
 
bool isBetterElectron (reco::GsfElectron const &, reco::GsfElectron const &)
 
bool isInnermostElectron (reco::GsfElectron const &, reco::GsfElectron const &)
 
int sharedDets (reco::GsfTrackRef const &, reco::GsfTrackRef const &)
 
float sharedEnergy (reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
 
float sharedEnergy (reco::SuperClusterRef const &sc1, reco::SuperClusterRef const &sc2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
 
int sharedHits (reco::GsfTrackRef const &, reco::GsfTrackRef const &)
 
double simpleElectronEnergyUncertainty (reco::GsfElectron const &)
 
CaloTowerDetId towerOf (reco::CaloCluster const &cluster, CaloTowerConstituentsMap const &towerMap)
 
std::vector< CaloTowerDetIdtowersOf (reco::SuperCluster const &sc, CaloTowerConstituentsMap const &towerMap, HoeMode mode=HoeMode::SingleTower)
 

Enumeration Type Documentation

◆ HoeMode

enum egamma::HoeMode
strong
Enumerator
SingleTower 
TowersBehindCluster 

Definition at line 16 of file EgammaHadTower.h.

16 { SingleTower = 0, TowersBehindCluster = 1 };

Function Documentation

◆ classBasedElectronEnergy()

float egamma::classBasedElectronEnergy ( reco::GsfElectron const &  electron,
reco::BeamSpot const &  bs,
EcalClusterFunctionBaseClass const &  crackCorrectionFunction 
)

Definition at line 295 of file ElectronEnergyCorrector.cc.

298  {
299  auto elClass = electron.classification();
300 
301  // new corrections from N. Chanon et al., taken from EcalClusterCorrectionObjectSpecific.cc
302  float corr = 1.;
303  float corr2 = 1.;
304  float energy = electron.superCluster()->energy();
305 
306  //int subdet = electron.superCluster()->seed()->hitsAndFractions()[0].first.subdetId();
307 
308  if (electron.isEB()) {
309  float cetacorr = fEta(electron.superCluster()->rawEnergy(), electron.superCluster()->eta(), 0) /
310  electron.superCluster()->rawEnergy();
311  energy = electron.superCluster()->rawEnergy() * cetacorr; //previously in CMSSW
312  //energy = superCluster.rawEnergy()*fEta(e5x5, superCluster.seed()->eta(), 0)/e5x5;
313  } else if (electron.isEE()) {
314  energy = electron.superCluster()->rawEnergy() + electron.superCluster()->preshowerEnergy();
315  } else {
316  edm::LogWarning("ElectronEnergyCorrector::classBasedParameterizationEnergy")
317  << "nor barrel neither endcap electron !";
318  }
319 
320  corr = fBremEta(electron.superCluster()->phiWidth() / electron.superCluster()->etaWidth(),
321  electron.superCluster()->eta(),
322  0,
323  elClass);
324 
325  float et = energy * std::sin(2 * std::atan(std::exp(-electron.superCluster()->eta()))) / corr;
326 
327  if (electron.isEB()) {
328  corr2 = corr * fEt(et, 0, elClass);
329  } else if (electron.isEE()) {
330  corr2 = corr * fEnergy(energy / corr, 1, elClass);
331  } else {
332  edm::LogWarning("ElectronEnergyCorrector::classBasedParameterizationEnergy")
333  << "nor barrel neither endcap electron !";
334  }
335 
336  float newEnergy = energy / corr2;
337 
338  // cracks
339  double crackcor = 1.;
340  for (reco::CaloCluster_iterator cIt = electron.superCluster()->clustersBegin();
341  cIt != electron.superCluster()->clustersEnd();
342  ++cIt) {
343  const reco::CaloClusterPtr cc = *cIt;
344  crackcor *= (electron.superCluster()->rawEnergy() + cc->energy() * (crackCorrectionFunction.getValue(*cc) - 1.)) /
345  electron.superCluster()->rawEnergy();
346  }
347  newEnergy *= crackcor;
348 
349  return newEnergy;

References alignCSCRings::corr, HPSPFTauProducerPuppi_cfi::electron, HCALHighEnergyHPDFilter_cfi::energy, EgHLTOffHistBins_cfi::et, JetChargeProducer_cfi::exp, hcaldqm::quantity::fEnergy, EcalClusterFunctionBaseClass::getValue(), and funct::sin().

Referenced by GsfElectronAlgo::createElectron().

◆ classBasedElectronEnergyUncertainty()

double egamma::classBasedElectronEnergyUncertainty ( reco::GsfElectron const &  electron)

Definition at line 270 of file ElectronEnergyCorrector.cc.

271  {
272  double ecalEnergy = electron.correctedEcalEnergy();
273  double eleEta = electron.superCluster()->eta();
274  double brem = electron.superCluster()->etaWidth() / electron.superCluster()->phiWidth();
275  return egamma::electronEnergyUncertainty(electron.classification(), eleEta, brem, ecalEnergy);

References HPSPFTauProducerPuppi_cfi::electron, and electronEnergyUncertainty().

Referenced by GsfElectronAlgo::createElectron().

◆ classifyElectron()

reco::GsfElectron::Classification egamma::classifyElectron ( reco::GsfElectron const &  )

◆ correctElectronMomentum()

egamma::ElectronMomentum egamma::correctElectronMomentum ( reco::GsfElectron const &  electron,
TrajectoryStateOnSurface const &  vtxTsos 
)

Definition at line 22 of file ElectronMomentumCorrector.cc.

24  {
25  int elClass = electron.classification();
26 
27  //=======================================================================================
28  // cluster energy
29  //=======================================================================================
30 
31  float scEnergy = electron.correctedEcalEnergy();
32  float errorEnergy = electron.correctedEcalEnergyError();
33 
34  //=======================================================================================
35  // track momentum
36  //=======================================================================================
37 
38  // basic values
39  float trackMomentum = electron.trackMomentumAtVtx().R();
40  //float errorTrackMomentum = 999. ;
41 
42  // tracker momentum scale corrections (Mykhailo Dalchenko)
43  double scale = 1.;
44  if (electron.isEB()) {
45  if (elClass == 0) {
46  scale = 1. / (0.00104 * sqrt(trackMomentum) + 1);
47  }
48  if (elClass == 1) {
49  scale = 1. / (0.0017 * sqrt(trackMomentum) + 0.9986);
50  }
51  if (elClass == 3) {
52  scale = 1. / (1.004 - 0.00021 * trackMomentum);
53  }
54  if (elClass == 4) {
55  scale = 0.995;
56  }
57  } else if (electron.isEE()) {
58  if (elClass == 3) {
59  scale = 1. / (1.01432 - 0.00201872 * trackMomentum + 0.0000142621 * trackMomentum * trackMomentum);
60  }
61  if (elClass == 4) {
62  scale = 1. / (0.996859 - 0.000345347 * trackMomentum);
63  }
64  }
65  if (scale < 0.)
66  scale = 1.; // CC added protection
68 
69  // error (must be done after trackMomentum rescaling)
71  GaussianSumUtilities1D qpUtils(qpState);
72  float errorTrackMomentum = trackMomentum * trackMomentum * sqrt(qpUtils.mode().variance());
73 
74  //=======================================================================================
75  // combination
76  //=======================================================================================
77 
78  float finalMomentum = electron.p4().t(); // initial
79  float finalMomentumError = 999.;
80 
81  // first check for large errors
82 
83  if (errorTrackMomentum / trackMomentum > 0.5 && errorEnergy / scEnergy <= 0.5) {
84  finalMomentum = scEnergy;
85  finalMomentumError = errorEnergy;
86  } else if (errorTrackMomentum / trackMomentum <= 0.5 && errorEnergy / scEnergy > 0.5) {
87  finalMomentum = trackMomentum;
88  finalMomentumError = errorTrackMomentum;
89  } else if (errorTrackMomentum / trackMomentum > 0.5 && errorEnergy / scEnergy > 0.5) {
90  if (errorTrackMomentum / trackMomentum < errorEnergy / scEnergy) {
91  finalMomentum = trackMomentum;
92  finalMomentumError = errorTrackMomentum;
93  } else {
94  finalMomentum = scEnergy;
95  finalMomentumError = errorEnergy;
96  }
97  }
98 
99  // then apply the combination algorithm
100  else {
101  // calculate E/p and corresponding error
102  float eOverP = scEnergy / trackMomentum;
103  float errorEOverP = sqrt((errorEnergy / trackMomentum) * (errorEnergy / trackMomentum) +
104  (scEnergy * errorTrackMomentum / trackMomentum / trackMomentum) *
105  (scEnergy * errorTrackMomentum / trackMomentum / trackMomentum));
106 
107  bool eleIsNotInCombination = false;
108  if ((eOverP > 1 + 2.5 * errorEOverP) || (eOverP < 1 - 2.5 * errorEOverP) || (eOverP < 0.8) || (eOverP > 1.3)) {
109  eleIsNotInCombination = true;
110  }
111  if (eleIsNotInCombination) {
112  if (eOverP > 1) {
113  finalMomentum = scEnergy;
114  finalMomentumError = errorEnergy;
115  } else {
116  if (elClass == reco::GsfElectron::GOLDEN) {
117  finalMomentum = scEnergy;
118  finalMomentumError = errorEnergy;
119  }
120  if (elClass == reco::GsfElectron::BIGBREM) {
121  if (scEnergy < 36) {
122  finalMomentum = trackMomentum;
123  finalMomentumError = errorTrackMomentum;
124  } else {
125  finalMomentum = scEnergy;
126  finalMomentumError = errorEnergy;
127  }
128  }
129  if (elClass == reco::GsfElectron::BADTRACK) {
130  finalMomentum = scEnergy;
131  finalMomentumError = errorEnergy;
132  }
133  if (elClass == reco::GsfElectron::SHOWERING) {
134  if (scEnergy < 30) {
135  finalMomentum = trackMomentum;
136  finalMomentumError = errorTrackMomentum;
137  } else {
138  finalMomentum = scEnergy;
139  finalMomentumError = errorEnergy;
140  }
141  }
142  if (elClass == reco::GsfElectron::GAP) {
143  if (scEnergy < 60) {
144  finalMomentum = trackMomentum;
145  finalMomentumError = errorTrackMomentum;
146  } else {
147  finalMomentum = scEnergy;
148  finalMomentumError = errorEnergy;
149  }
150  }
151  }
152  }
153 
154  else {
155  // combination
156  finalMomentum = (scEnergy / errorEnergy / errorEnergy + trackMomentum / errorTrackMomentum / errorTrackMomentum) /
157  (1 / errorEnergy / errorEnergy + 1 / errorTrackMomentum / errorTrackMomentum);
158  float finalMomentumVariance = 1 / (1 / errorEnergy / errorEnergy + 1 / errorTrackMomentum / errorTrackMomentum);
159  finalMomentumError = sqrt(finalMomentumVariance);
160  }
161  }
162 
163  //=======================================================================================
164  // final set
165  //=======================================================================================
166 
167  auto const& oldMomentum = electron.p4();
168 
169  return {{oldMomentum.x() * finalMomentum / oldMomentum.t(),
170  oldMomentum.y() * finalMomentum / oldMomentum.t(),
171  oldMomentum.z() * finalMomentum / oldMomentum.t(),
172  finalMomentum},
173  errorTrackMomentum,
174  finalMomentumError};

References reco::GsfElectron::BADTRACK, reco::GsfElectron::BIGBREM, HPSPFTauProducerPuppi_cfi::electron, EgHLTOffHistBins_cfi::eOverP, reco::GsfElectron::GAP, reco::GsfElectron::GOLDEN, GaussianSumUtilities1D::mode(), MultiGaussianStateTransform::multiState1D(), L1EGammaCrystalsEmulatorProducer_cfi::scale, reco::GsfElectron::SHOWERING, mathSSE::sqrt(), reco::btau::trackMomentum, and SingleGaussianState1D::variance().

Referenced by GsfElectronAlgo::createElectron().

◆ depth1HcalESum()

double egamma::depth1HcalESum ( std::vector< CaloTowerDetId > const &  towers,
CaloTowerCollection const &  towerCollection 
)

Definition at line 73 of file EgammaHadTower.cc.

73  {
74  double esum = 0.;
75  for (auto const& tower : towerCollection) {
76  if (std::find(towers.begin(), towers.end(), tower.id()) != towers.end()) {
77  esum += tower.ietaAbs() < 18 || tower.ietaAbs() > 29 ? tower.hadEnergy() : tower.hadEnergyHeInnerLayer();
78  }
79  }
80  return esum;
81 }

References spr::find(), hgcalTowerProducer_cfi::tower, and HLT_FULL_cff::towers.

Referenced by SuperClusterImporter::importToBlock(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

◆ depth2HcalESum()

double egamma::depth2HcalESum ( std::vector< CaloTowerDetId > const &  towers,
CaloTowerCollection const &  towerCollection 
)

Definition at line 83 of file EgammaHadTower.cc.

83  {
84  double esum = 0.;
85  for (auto const& tower : towerCollection) {
86  if (std::find(towers.begin(), towers.end(), tower.id()) != towers.end()) {
87  esum += tower.hadEnergyHeOuterLayer();
88  }
89  }
90  return esum;
91 }

References spr::find(), hgcalTowerProducer_cfi::tower, and HLT_FULL_cff::towers.

Referenced by SuperClusterImporter::importToBlock(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

◆ ecalClusterEnergyUncertaintyElectronSpecific()

float egamma::ecalClusterEnergyUncertaintyElectronSpecific ( reco::SuperCluster const &  superCluster)

Definition at line 4 of file ecalClusterEnergyUncertaintyElectronSpecific.cc.

4  {
5  float en = superCluster.energy();
6  float eta = fabs(superCluster.eta());
7  float et = en / cosh(eta);
8  float brem = superCluster.etaWidth() != 0 ? superCluster.phiWidth() / superCluster.etaWidth() : 0;
9 
10  const int nBinsEta = 6;
11  const float EtaBins[nBinsEta + 1] = {0.0, 0.7, 1.15, 1.44, 1.56, 2.0, 2.5};
12 
13  const int nBinsBrem = 6;
14  const float BremBins[nBinsBrem + 1] = {0.8, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0};
15 
16  float par0[nBinsEta][nBinsBrem];
17  float par1[nBinsEta][nBinsBrem];
18  float par2[nBinsEta][nBinsBrem];
19  float par3[nBinsEta][nBinsBrem];
20 
21  par0[0][0] = 0.00640519;
22  par1[0][0] = 0.257578;
23  par2[0][0] = 1.72437;
24  par3[0][0] = 4.04686e-06;
25 
26  par0[0][1] = 0.00709569;
27  par1[0][1] = 0.279844;
28  par2[0][1] = 1.13789;
29  par3[0][1] = 1.16239e-05;
30 
31  par0[0][2] = 0.0075544;
32  par1[0][2] = 0.341346;
33  par2[0][2] = 0.513396;
34  par3[0][2] = 2.90054e-06;
35 
36  par0[0][3] = 0.00659365;
37  par1[0][3] = 0.517649;
38  par2[0][3] = -3.1847;
39  par3[0][3] = 7.37152e-07;
40 
41  par0[0][4] = 0.00771696;
42  par1[0][4] = 0.492897;
43  par2[0][4] = -1.42222;
44  par3[0][4] = 0.000358677;
45 
46  par0[0][5] = 0.00561532;
47  par1[0][5] = 0.655138;
48  par2[0][5] = -3.29839;
49  par3[0][5] = 6.25898e-07;
50 
51  par0[1][0] = 0.00273646;
52  par1[1][0] = 0.714568;
53  par2[1][0] = -4.82956;
54  par3[1][0] = 4.45878e-07;
55 
56  par0[1][1] = 0.00679797;
57  par1[1][1] = 0.472856;
58  par2[1][1] = -0.281699;
59  par3[1][1] = 5.46479e-05;
60 
61  par0[1][2] = 0.00845532;
62  par1[1][2] = 0.611624;
63  par2[1][2] = -1.10104;
64  par3[1][2] = 1.16803e-05;
65 
66  par0[1][3] = 0.00831068;
67  par1[1][3] = 0.853653;
68  par2[1][3] = -4.23761;
69  par3[1][3] = 2.61247e-05;
70 
71  par0[1][4] = 0.00845457;
72  par1[1][4] = 0.984985;
73  par2[1][4] = -5.19548;
74  par3[1][4] = 2.05044e-07;
75 
76  par0[1][5] = 0.0110227;
77  par1[1][5] = 1.00356;
78  par2[1][5] = -4.31936;
79  par3[1][5] = 0.14384;
80 
81  par0[2][0] = -0.00192618;
82  par1[2][0] = 1.69986;
83  par2[2][0] = -16.4355;
84  par3[2][0] = 1.94946e-06;
85 
86  par0[2][1] = 0.0067622;
87  par1[2][1] = 0.792209;
88  par2[2][1] = -1.18521;
89  par3[2][1] = 0.066577;
90 
91  par0[2][2] = 0.00761595;
92  par1[2][2] = 1.03058;
93  par2[2][2] = -4.17237;
94  par3[2][2] = 0.168543;
95 
96  par0[2][3] = 0.0119179;
97  par1[2][3] = 0.910145;
98  par2[2][3] = -2.14122;
99  par3[2][3] = 0.00342264;
100 
101  par0[2][4] = 0.0139921;
102  par1[2][4] = 1.01488;
103  par2[2][4] = -2.46637;
104  par3[2][4] = 0.0458434;
105 
106  par0[2][5] = 0.013724;
107  par1[2][5] = 1.49078;
108  par2[2][5] = -6.60661;
109  par3[2][5] = 0.297821;
110 
111  par0[3][0] = -0.00197909;
112  par1[3][0] = 4.40696;
113  par2[3][0] = -4.88737;
114  par3[3][0] = 4.99999;
115 
116  par0[3][1] = 0.0340196;
117  par1[3][1] = 3.86278;
118  par2[3][1] = -10.899;
119  par3[3][1] = 0.130098;
120 
121  par0[3][2] = 0.0102397;
122  par1[3][2] = 8.99643;
123  par2[3][2] = -31.5122;
124  par3[3][2] = 0.00118335;
125 
126  par0[3][3] = 0.0110891;
127  par1[3][3] = 8.01794;
128  par2[3][3] = -21.9038;
129  par3[3][3] = 0.000245975;
130 
131  par0[3][4] = 0.0328931;
132  par1[3][4] = 4.73441;
133  par2[3][4] = -12.1148;
134  par3[3][4] = 3.01721e-05;
135 
136  par0[3][5] = 0.0395614;
137  par1[3][5] = 3.54327;
138  par2[3][5] = -12.6514;
139  par3[3][5] = 0.119761;
140 
141  par0[4][0] = 0.0121809;
142  par1[4][0] = 0.965608;
143  par2[4][0] = -4.19667;
144  par3[4][0] = 0.129896;
145 
146  par0[4][1] = 0.0168951;
147  par1[4][1] = 1.0218;
148  par2[4][1] = -4.03078;
149  par3[4][1] = 0.374291;
150 
151  par0[4][2] = 0.0213549;
152  par1[4][2] = 1.29613;
153  par2[4][2] = -4.89024;
154  par3[4][2] = 0.0297165;
155 
156  par0[4][3] = 0.0262602;
157  par1[4][3] = 1.41674;
158  par2[4][3] = -5.94928;
159  par3[4][3] = 0.19298;
160 
161  par0[4][4] = 0.0334892;
162  par1[4][4] = 1.48572;
163  par2[4][4] = -5.3175;
164  par3[4][4] = 0.0157013;
165 
166  par0[4][5] = 0.0347093;
167  par1[4][5] = 1.63127;
168  par2[4][5] = -7.27426;
169  par3[4][5] = 0.201164;
170 
171  par0[5][0] = 0.0185321;
172  par1[5][0] = 0.255205;
173  par2[5][0] = 1.56798;
174  par3[5][0] = 5.07655e-11;
175 
176  par0[5][1] = 0.0182718;
177  par1[5][1] = 0.459086;
178  par2[5][1] = -0.48198;
179  par3[5][1] = 0.00114946;
180 
181  par0[5][2] = 0.0175505;
182  par1[5][2] = 0.92848;
183  par2[5][2] = -4.52737;
184  par3[5][2] = 0.154827;
185 
186  par0[5][3] = 0.0233833;
187  par1[5][3] = 0.804105;
188  par2[5][3] = -3.75131;
189  par3[5][3] = 2.84172;
190 
191  par0[5][4] = 0.0334892;
192  par1[5][4] = 1.48572;
193  par2[5][4] = -5.3175;
194  par3[5][4] = 0.0157013;
195 
196  par0[5][5] = 0.0347093;
197  par1[5][5] = 1.63127;
198  par2[5][5] = -7.27426;
199  par3[5][5] = 0.201164;
200 
201  int iEtaSl = -1;
202  for (int iEta = 0; iEta < nBinsEta; ++iEta) {
203  if (EtaBins[iEta] <= eta && eta < EtaBins[iEta + 1]) {
204  iEtaSl = iEta;
205  }
206  }
207 
208  int iBremSl = -1;
209  for (int iBrem = 0; iBrem < nBinsBrem; ++iBrem) {
210  if (BremBins[iBrem] <= brem && brem < BremBins[iBrem + 1]) {
211  iBremSl = iBrem;
212  }
213  }
214 
215  //this code is confusing as it has no concept of under and overflow bins
216  //we will use Et as an example but also applies to eta
217  //underflow is 1st bin (naively currently labeled as 0 to 0.7, its really <0.7)
218  //overflow is the final bin (naviely currently labeled as 5 to 10, its really >=5)
219  //logic: if brem is 0<=brem <0.7 it will be already set to the 1st bin, this checks if its <0
220  //logic: if brem is 5<=brem<10 it will be set to the last bin so this then checks if its >5 at which point
221  //it also assigns it to the last bin. The value of 5 will have already been assigned in the for
222  //loop above to the last bin so its okay that its a >5 test
223  if (eta > EtaBins[nBinsEta - 1])
224  iEtaSl = nBinsEta - 1;
225  if (brem < BremBins[0])
226  iBremSl = 0;
227  if (brem > BremBins[nBinsBrem - 1])
228  iBremSl = nBinsBrem - 1;
229 
230  float uncertainty = 0;
231  if (et <= 5)
232  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (5 - par2[iEtaSl][iBremSl]) +
233  par3[iEtaSl][iBremSl] / ((5 - par2[iEtaSl][iBremSl]) * (5 - par2[iEtaSl][iBremSl]));
234  if (et >= 200)
235  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (200 - par2[iEtaSl][iBremSl]) +
236  par3[iEtaSl][iBremSl] / ((200 - par2[iEtaSl][iBremSl]) * (200 - par2[iEtaSl][iBremSl]));
237 
238  if (et > 5 && et < 200)
239  uncertainty = par0[iEtaSl][iBremSl] + par1[iEtaSl][iBremSl] / (et - par2[iEtaSl][iBremSl]) +
240  par3[iEtaSl][iBremSl] / ((et - par2[iEtaSl][iBremSl]) * (et - par2[iEtaSl][iBremSl]));
241 
242  return (uncertainty * en);
243 }

References reco::CaloCluster::energy(), EgHLTOffHistBins_cfi::et, PVValHelper::eta, reco::CaloCluster::eta(), MuonErrorMatrixAnalyzer_cfi::EtaBins, reco::SuperCluster::etaWidth(), L1TowerCalibrationProducer_cfi::iEta, hgcalTowerMapProducer_cfi::nBinsEta, pfMETCorrectionType0_cfi::par0, pfMETCorrectionType0_cfi::par1, pfMETCorrectionType0_cfi::par2, pfMETCorrectionType0_cfi::par3, and reco::SuperCluster::phiWidth().

Referenced by GsfElectronAlgo::createElectron().

◆ electronEnergyUncertainty()

double egamma::electronEnergyUncertainty ( reco::GsfElectron::Classification  c,
double  eta,
double  brem,
double  energy 
)

Definition at line 403 of file EnergyUncertaintyElectronSpecific.cc.

403  {
404  if (c == GsfElectron::GOLDEN)
405  return computeEnergyUncertaintyGolden(eta, brem, energy);
406  if (c == GsfElectron::BIGBREM)
407  return computeEnergyUncertaintyBigbrem(eta, brem, energy);
408  if (c == GsfElectron::SHOWERING)
409  return computeEnergyUncertaintyShowering(eta, brem, energy);
410  if (c == GsfElectron::BADTRACK)
411  return computeEnergyUncertaintyBadTrack(eta, brem, energy);
412  if (c == GsfElectron::GAP)
413  return computeEnergyUncertaintyCracks(eta, brem, energy);
414  throw cms::Exception("GsfElectronAlgo|InternalError") << "unknown classification";
415 }

References c, HCALHighEnergyHPDFilter_cfi::energy, PVValHelper::eta, and Exception.

Referenced by classBasedElectronEnergyUncertainty().

◆ getClosestCtfToGsf()

std::pair< TrackRef, float > egamma::getClosestCtfToGsf ( reco::GsfTrackRef const &  gsfTrackRef,
edm::Handle< reco::TrackCollection > const &  ctfTracksH,
edm::soa::EtaPhiTableView  trackEtaPhiTable 
)

Definition at line 16 of file GsfElectronTools.cc.

18  {
19  float maxFracShared = 0;
20  TrackRef ctfTrackRef = TrackRef();
21  const TrackCollection* ctfTrackCollection = ctfTracksH.product();
22 
23  float gsfEta = gsfTrackRef->eta();
24  float gsfPhi = gsfTrackRef->phi();
25  const HitPattern& gsfHitPattern = gsfTrackRef->hitPattern();
26 
27  constexpr float dR2 = 0.3 * 0.3;
28 
29  unsigned int counter = 0;
30  for (auto ctfTkIter = ctfTrackCollection->begin(); ctfTkIter != ctfTrackCollection->end(); ctfTkIter++, counter++) {
31  // dont want to look at every single track in the event!
32  using namespace edm::soa::col;
33  if (reco::deltaR2(gsfEta, gsfPhi, trackTable.get<Eta>(counter), trackTable.get<Phi>(counter)) > dR2)
34  continue;
35 
36  unsigned int shared = 0;
37  int gsfHitCounter = 0;
38  int numGsfInnerHits = 0;
39  int numCtfInnerHits = 0;
40  // get the CTF Track Hit Pattern
41  const HitPattern& ctfHitPattern = ctfTkIter->hitPattern();
42 
43  for (auto elHitsIt = gsfTrackRef->recHitsBegin(); elHitsIt != gsfTrackRef->recHitsEnd();
44  elHitsIt++, gsfHitCounter++) {
45  if (!((**elHitsIt).isValid())) //count only valid Hits
46  {
47  continue;
48  }
49 
50  // look only in the pixels/TIB/TID
51  uint32_t gsfHit = gsfHitPattern.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter);
52  if (!(HitPattern::pixelHitFilter(gsfHit) || HitPattern::stripTIBHitFilter(gsfHit) ||
53  HitPattern::stripTIDHitFilter(gsfHit))) {
54  continue;
55  }
56 
57  numGsfInnerHits++;
58 
59  int ctfHitsCounter = 0;
60  numCtfInnerHits = 0;
61  for (auto ctfHitsIt = ctfTkIter->recHitsBegin(); ctfHitsIt != ctfTkIter->recHitsEnd();
62  ctfHitsIt++, ctfHitsCounter++) {
63  if (!((**ctfHitsIt).isValid())) //count only valid Hits!
64  {
65  continue;
66  }
67 
68  uint32_t ctfHit = ctfHitPattern.getHitPattern(HitPattern::TRACK_HITS, ctfHitsCounter);
69  if (!(HitPattern::pixelHitFilter(ctfHit) || HitPattern::stripTIBHitFilter(ctfHit) ||
70  HitPattern::stripTIDHitFilter(ctfHit))) {
71  continue;
72  }
73 
74  numCtfInnerHits++;
75 
76  if ((**elHitsIt).sharesInput(&(**ctfHitsIt), TrackingRecHit::all)) {
77  shared++;
78  break;
79  }
80 
81  } //ctfHits iterator
82 
83  } //gsfHits iterator
84 
85  if ((numGsfInnerHits == 0) || (numCtfInnerHits == 0)) {
86  continue;
87  }
88 
89  if (static_cast<float>(shared) / std::min(numGsfInnerHits, numCtfInnerHits) > maxFracShared) {
90  maxFracShared = static_cast<float>(shared) / std::min(numGsfInnerHits, numCtfInnerHits);
91  ctfTrackRef = TrackRef(ctfTracksH, counter);
92  }
93 
94  } //ctfTrack iterator
95 
96  return {ctfTrackRef, maxFracShared};
97  }

References TrackingRecHit::all, reco::deltaR2(), reco::HitPattern::getHitPattern(), reco::HitPattern::hitPattern, min(), reco::HitPattern::pixelHitFilter(), edm::Handle< T >::product(), reco::HitPattern::stripTIBHitFilter(), reco::HitPattern::stripTIDHitFilter(), and reco::HitPattern::TRACK_HITS.

Referenced by LowPtGsfElectronCoreProducer::produce(), GsfElectronCoreEcalDrivenProducer::produce(), and GEDGsfElectronCoreProducer::produceElectronCore().

◆ getRandomSeedFromObj()

template<typename T >
uint32_t egamma::getRandomSeedFromObj ( const edm::Event iEvent,
const T obj,
size_t  nrObjs,
size_t  objNr 
)

Definition at line 21 of file EgammaRandomSeeds.h.

21  {
22  std::seed_seq seeder = {int(iEvent.id().event()),
23  int(iEvent.id().luminosityBlock()),
24  int(iEvent.id().run()),
25  int(nrObjs),
26  int(std::numeric_limits<int>::max() * obj.phi() / M_PI) & 0xFFF,
27  int(objNr)};
28  uint32_t seed = 0, tries = 10;
29  do {
30  seeder.generate(&seed, &seed + 1);
31  tries++;
32  } while (seed == 0 && tries < 10);
33  return seed ? seed : iEvent.id().event() + 10000 * objNr;
34  }

References iEvent, createfilelist::int, M_PI, SiStripPI::max, getGTfromDQMFile::obj, and fileCollector::seed.

Referenced by CalibratedPhotonProducerT< T >::setSemiDetRandomSeed(), and CalibratedElectronProducerT< T >::setSemiDetRandomSeed().

◆ getRandomSeedFromSC()

uint32_t egamma::getRandomSeedFromSC ( const edm::Event iEvent,
const reco::SuperClusterRef  scRef 
)

Definition at line 5 of file EgammaRandomSeeds.cc.

5  {
6  const int offset = 0; //for future expansion
7  std::seed_seq seeder = {int(iEvent.id().event()),
8  int(iEvent.id().luminosityBlock()),
9  int(iEvent.id().run()),
10  int(scRef->seed()->seed().rawId()),
11  int(scRef->seed()->hitsAndFractions().size()),
12  offset};
13  uint32_t seed = 0, tries = 10;
14  do {
15  seeder.generate(&seed, &seed + 1);
16  tries++;
17  } while (seed == 0 && tries < 10);
18  return seed ? seed : iEvent.id().event() + 10000 * scRef.key();
19 }

References iEvent, createfilelist::int, edm::Ref< C, T, F >::key(), hltrates_dqm_sourceclient-live_cfg::offset, and fileCollector::seed.

Referenced by CalibratedPhotonProducerT< T >::setSemiDetRandomSeed(), and CalibratedElectronProducerT< T >::setSemiDetRandomSeed().

◆ hasActiveHcal()

bool egamma::hasActiveHcal ( std::vector< CaloTowerDetId > const &  towers,
CaloTowerConstituentsMap const &  towerMap,
HcalChannelQuality const &  hcalQuality,
HcalTopology const &  hcalTopology 
)

Definition at line 93 of file EgammaHadTower.cc.

96  {
97  bool active = false;
98  int statusMask = ((1 << HcalChannelStatus::HcalCellOff) | (1 << HcalChannelStatus::HcalCellMask) |
100 #ifdef EDM_ML_DEBUG
101  std::cout << "DEBUG: hasActiveHcal called with " << towers.size() << " detids. First tower detid ieta "
102  << towers.front().ieta() << " iphi " << towers.front().iphi() << std::endl;
103 #endif
104  for (auto towerid : towers) {
105  unsigned int ngood = 0, nbad = 0;
106  for (DetId id : towerMap.constituentsOf(towerid)) {
107  if (id.det() != DetId::Hcal) {
108  continue;
109  }
110  HcalDetId hid(id);
111  if (hid.subdet() != HcalBarrel && hid.subdet() != HcalEndcap)
112  continue;
113 #ifdef EDM_ML_DEBUG
114  std::cout << "EgammaHadTower DetId " << std::hex << id.rawId() << " hid.rawId " << hid.rawId() << std::dec
115  << " sub " << hid.subdet() << " ieta " << hid.ieta() << " iphi " << hid.iphi() << " depth "
116  << hid.depth() << std::endl;
117 #endif
118  // Sunanda's fix for 2017 Plan1
119  // and removed protection
120  int status =
121  hcalQuality.getValues((DetId)(hcalTopology.idFront(HcalDetId(id))), /*throwOnFail=*/true)->getValue();
122 
123 #ifdef EDM_ML_DEBUG
124  std::cout << "channels status = " << std::hex << status << std::dec << " int value = " << status << std::endl;
125 #endif
126 
127  if (status & statusMask) {
128 #ifdef EDM_ML_DEBUG
129  std::cout << " BAD!" << std::endl;
130 #endif
131  nbad++;
132  } else {
133  ngood++;
134  }
135  }
136 #ifdef EDM_ML_DEBUG
137  std::cout << " overall ngood " << ngood << " nbad " << nbad << "\n";
138 #endif
139  if (nbad == 0 || (ngood > 0 && nbad < ngood)) {
140  active = true;
141  }
142  }
143  return active;
144 }

References CaloTowerConstituentsMap::constituentsOf(), gather_cfg::cout, TauDecayModes::dec, HcalDetId::depth(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), DetId::Hcal, HcalBarrel, HcalChannelStatus::HcalCellDead, HcalChannelStatus::HcalCellMask, HcalChannelStatus::HcalCellOff, HcalEndcap, HcalTopology::idFront(), HcalDetId::ieta(), HcalDetId::iphi(), DetId::rawId(), mps_update::status, HcalDetId::subdet(), and HLT_FULL_cff::towers.

Referenced by ElectronHcalHelper::hasActiveHcal().

◆ isBetterElectron()

bool egamma::isBetterElectron ( reco::GsfElectron const &  e1,
reco::GsfElectron const &  e2 
)

Definition at line 16 of file EgAmbiguityTools.cc.

16  {
17  return (std::abs(e1.eSuperClusterOverP() - 1) < std::abs(e2.eSuperClusterOverP() - 1));
18  }

References funct::abs(), StorageManager_cfg::e1, and reco::GsfElectron::eSuperClusterOverP().

Referenced by isInnermostElectron(), and GsfElectronProducer::setAmbiguityData().

◆ isInnermostElectron()

bool egamma::isInnermostElectron ( reco::GsfElectron const &  e1,
reco::GsfElectron const &  e2 
)

Definition at line 20 of file EgAmbiguityTools.cc.

20  {
21  // retreive first valid hit
22  int gsfHitCounter1 = 0;
23  for (auto const& elHit : e1.gsfTrack()->recHits()) {
24  if (elHit->isValid())
25  break;
26  gsfHitCounter1++;
27  }
28 
29  int gsfHitCounter2 = 0;
30  for (auto const& elHit : e2.gsfTrack()->recHits()) {
31  if (elHit->isValid())
32  break;
33  gsfHitCounter2++;
34  }
35 
36  uint32_t gsfHit1 = e1.gsfTrack()->hitPattern().getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
37  uint32_t gsfHit2 = e2.gsfTrack()->hitPattern().getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter2);
38 
39  if (HitPattern::getSubStructure(gsfHit1) != HitPattern::getSubStructure(gsfHit2)) {
40  return (HitPattern::getSubStructure(gsfHit1) < HitPattern::getSubStructure(gsfHit2));
41  } else if (HitPattern::getLayer(gsfHit1) != HitPattern::getLayer(gsfHit2)) {
42  return (HitPattern::getLayer(gsfHit1) < HitPattern::getLayer(gsfHit2));
43  } else {
44  return isBetterElectron(e1, e2);
45  }
46  }

References StorageManager_cfg::e1, reco::GsfElectron::gsfTrack(), and isBetterElectron().

Referenced by GsfElectronProducer::setAmbiguityData().

◆ sharedDets()

int egamma::sharedDets ( reco::GsfTrackRef const &  gsfTrackRef1,
reco::GsfTrackRef const &  gsfTrackRef2 
)

Definition at line 95 of file EgAmbiguityTools.cc.

95  {
96  //get the Hit Pattern for the gsfTracks
97  const HitPattern& gsfHitPattern1 = gsfTrackRef1->hitPattern();
98  const HitPattern& gsfHitPattern2 = gsfTrackRef2->hitPattern();
99 
100  unsigned int shared = 0;
101 
102  int gsfHitCounter1 = 0;
103  for (trackingRecHit_iterator elHitsIt1 = gsfTrackRef1->recHitsBegin(); elHitsIt1 != gsfTrackRef1->recHitsEnd();
104  elHitsIt1++, gsfHitCounter1++) {
105  if (!((**elHitsIt1).isValid())) {
106  //count only valid Hits
107  continue;
108  }
109  //if (gsfHitCounter1>1) continue; // to test only the first hit of the track 1
110  uint32_t gsfHit = gsfHitPattern1.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
111  if (!(HitPattern::pixelHitFilter(gsfHit) || HitPattern::stripTIBHitFilter(gsfHit) ||
112  HitPattern::stripTOBHitFilter(gsfHit) || HitPattern::stripTECHitFilter(gsfHit) ||
113  HitPattern::stripTIDHitFilter(gsfHit))) {
114  continue;
115  }
116 
117  int gsfHitsCounter2 = 0;
118  for (trackingRecHit_iterator gsfHitsIt2 = gsfTrackRef2->recHitsBegin(); gsfHitsIt2 != gsfTrackRef2->recHitsEnd();
119  gsfHitsIt2++, gsfHitsCounter2++) {
120  if (!((**gsfHitsIt2).isValid())) {
121  //count only valid Hits!
122  continue;
123  }
124 
125  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(HitPattern::TRACK_HITS, gsfHitsCounter2);
126  if (!(HitPattern::pixelHitFilter(gsfHit2) || HitPattern::stripTIBHitFilter(gsfHit2) ||
127  HitPattern::stripTOBHitFilter(gsfHit2) || HitPattern::stripTECHitFilter(gsfHit2) ||
128  HitPattern::stripTIDHitFilter(gsfHit2)))
129  continue;
130  if ((**elHitsIt1).geographicalId() == (**gsfHitsIt2).geographicalId())
131  shared++;
132  } //gsfHits2 iterator
133  } //gsfHits1 iterator
134 
135  //std::cout << "[sharedHits] number of shared dets " << shared << std::endl;
136  //return shared/min(gsfTrackRef1->numberOfValidHits(),gsfTrackRef2->numberOfValidHits());
137  return shared;
138  }

References reco::HitPattern::getHitPattern().

◆ sharedEnergy() [1/2]

float egamma::sharedEnergy ( reco::CaloCluster const &  clu1,
reco::CaloCluster const &  clu2,
EcalRecHitCollection const &  barrelRecHits,
EcalRecHitCollection const &  endcapRecHits 
)

Definition at line 140 of file EgAmbiguityTools.cc.

143  {
144  double fractionShared = 0;
145 
146  for (auto const& h1 : clu1.hitsAndFractions()) {
147  for (auto const& h2 : clu2.hitsAndFractions()) {
148  if (h1.first != h2.first)
149  continue;
150 
151  // here we have common Xtal id
153  if (h1.first.subdetId() == EcalBarrel) {
154  if ((itt = barrelRecHits.find(h1.first)) != barrelRecHits.end())
155  fractionShared += itt->energy();
156  } else if (h1.first.subdetId() == EcalEndcap) {
157  if ((itt = endcapRecHits.find(h1.first)) != endcapRecHits.end())
158  fractionShared += itt->energy();
159  }
160  }
161  }
162 
163  //std::cout << "[sharedEnergy] shared energy /min(energy1,energy2) " << fractionShared << std::endl;
164  return fractionShared;
165  }

References HLT_FULL_cff::barrelRecHits, EcalBarrel, EcalEndcap, HLT_FULL_cff::endcapRecHits, HLT_FULL_cff::fractionShared, and reco::CaloCluster::hitsAndFractions().

Referenced by RealisticHitToClusterAssociator::findAndMergeInvisibleClusters(), GsfElectronProducer::setAmbiguityData(), and sharedEnergy().

◆ sharedEnergy() [2/2]

float egamma::sharedEnergy ( reco::SuperClusterRef const &  sc1,
reco::SuperClusterRef const &  sc2,
EcalRecHitCollection const &  barrelRecHits,
EcalRecHitCollection const &  endcapRecHits 
)

Definition at line 167 of file EgAmbiguityTools.cc.

170  {
171  double energyShared = 0;
172  for (CaloCluster_iterator icl1 = sc1->clustersBegin(); icl1 != sc1->clustersEnd(); icl1++) {
173  for (CaloCluster_iterator icl2 = sc2->clustersBegin(); icl2 != sc2->clustersEnd(); icl2++) {
174  energyShared += sharedEnergy(**icl1, **icl2, barrelRecHits, endcapRecHits);
175  }
176  }
177  return energyShared;
178  }

References HLT_FULL_cff::barrelRecHits, HLT_FULL_cff::endcapRecHits, and sharedEnergy().

◆ sharedHits()

int egamma::sharedHits ( reco::GsfTrackRef const &  gsfTrackRef1,
reco::GsfTrackRef const &  gsfTrackRef2 
)

Definition at line 48 of file EgAmbiguityTools.cc.

48  {
49  //get the Hit Pattern for the gsfTracks
50  HitPattern const& gsfHitPattern1 = gsfTrackRef1->hitPattern();
51  HitPattern const& gsfHitPattern2 = gsfTrackRef2->hitPattern();
52 
53  unsigned int shared = 0;
54 
55  int gsfHitCounter1 = 0;
56  for (trackingRecHit_iterator elHitsIt1 = gsfTrackRef1->recHitsBegin(); elHitsIt1 != gsfTrackRef1->recHitsEnd();
57  elHitsIt1++, gsfHitCounter1++) {
58  if (!(*elHitsIt1)->isValid()) {
59  //count only valid Hits
60  continue;
61  }
62  //if (gsfHitCounter1>1) continue; // test only the first hit of the track 1
63  uint32_t gsfHit = gsfHitPattern1.getHitPattern(HitPattern::TRACK_HITS, gsfHitCounter1);
64  if (!(HitPattern::pixelHitFilter(gsfHit) || HitPattern::stripTIBHitFilter(gsfHit) ||
65  HitPattern::stripTOBHitFilter(gsfHit) || HitPattern::stripTECHitFilter(gsfHit) ||
66  HitPattern::stripTIDHitFilter(gsfHit))) {
67  continue;
68  }
69 
70  int gsfHitsCounter2 = 0;
71  for (trackingRecHit_iterator gsfHitsIt2 = gsfTrackRef2->recHitsBegin(); gsfHitsIt2 != gsfTrackRef2->recHitsEnd();
72  gsfHitsIt2++, gsfHitsCounter2++) {
73  if (!(**gsfHitsIt2).isValid()) {
74  //count only valid Hits
75  continue;
76  }
77  uint32_t gsfHit2 = gsfHitPattern2.getHitPattern(HitPattern::TRACK_HITS, gsfHitsCounter2);
78  if (!(HitPattern::pixelHitFilter(gsfHit2) || HitPattern::stripTIBHitFilter(gsfHit2) ||
79  HitPattern::stripTOBHitFilter(gsfHit2) || HitPattern::stripTECHitFilter(gsfHit2) ||
80  HitPattern::stripTIDHitFilter(gsfHit2))) {
81  continue;
82  }
83  if ((*elHitsIt1)->sharesInput(&(**gsfHitsIt2), TrackingRecHit::some)) {
84  //if (comp.equals(&(**elHitsIt1),&(**gsfHitsIt2))) {
86  shared++;
87  }
88  } //gsfHits2 iterator
89  } //gsfHits1 iterator
90 
91  //std::cout << "[sharedHits] number of shared hits " << shared << std::endl;
92  return shared;
93  }

References reco::HitPattern::getHitPattern(), and TrackingRecHit::some.

◆ simpleElectronEnergyUncertainty()

double egamma::simpleElectronEnergyUncertainty ( reco::GsfElectron const &  electron)

Definition at line 277 of file ElectronEnergyCorrector.cc.

278  {
279  double error = 999.;
280  double ecalEnergy = electron.correctedEcalEnergy();
281 
282  if (electron.isEB()) {
283  float parEB[3] = {5.24e-02, 2.01e-01, 1.00e-02};
284  error = ecalEnergy * energyError(ecalEnergy, parEB);
285  } else if (electron.isEE()) {
286  float parEE[3] = {1.46e-01, 9.21e-01, 1.94e-03};
287  error = ecalEnergy * energyError(ecalEnergy, parEE);
288  } else {
289  edm::LogWarning("ElectronEnergyCorrector::simpleParameterizationUncertainty")
290  << "nor barrel neither endcap electron !";
291  }
292 
293  return error;

References HPSPFTauProducerPuppi_cfi::electron, and relativeConstraints::error.

Referenced by GsfElectronAlgo::createElectron().

◆ towerOf()

CaloTowerDetId egamma::towerOf ( reco::CaloCluster const &  cluster,
CaloTowerConstituentsMap const &  towerMap 
)

Definition at line 10 of file EgammaHadTower.cc.

10  {
11  DetId detid = cluster.seed();
12  if (detid.det() != DetId::Ecal) {
13  // Basic clusters of hybrid super-cluster do not have the seed set; take the first DetId instead
14  // Should be checked . The single Tower Mode should be favoured until fixed
15  detid = cluster.hitsAndFractions()[0].first;
16  if (detid.det() != DetId::Ecal) {
18  return tower;
19  }
20  }
21  CaloTowerDetId id(towerMap.towerOf(detid));
22  return id;
23 }

References DetId::det(), DetId::Ecal, reco::CaloCluster::hitsAndFractions(), triggerObjects_cff::id, reco::CaloCluster::seed(), hgcalTowerProducer_cfi::tower, and CaloTowerConstituentsMap::towerOf().

Referenced by EgammaHcalIsolation::getHcalESumBc(), EgammaHcalIsolation::getHcalEtSumBc(), ecaldqm::TrigPrimTask::runOnDigis(), and towersOf().

◆ towersOf()

std::vector< CaloTowerDetId > egamma::towersOf ( reco::SuperCluster const &  sc,
CaloTowerConstituentsMap const &  towerMap,
HoeMode  mode = HoeMode::SingleTower 
)

Definition at line 25 of file EgammaHadTower.cc.

27  {
28  constexpr unsigned int nMaxClusters = 4;
29 
30  std::vector<CaloTowerDetId> towers;
31  std::vector<reco::CaloClusterPtr> orderedClusters;
32 
33  // in this mode, check only the tower behind the seed
34  if (mode == HoeMode::SingleTower) {
35  towers.push_back(towerOf(*sc.seed(), towerMap));
36  }
37 
38  // in this mode check the towers behind each basic cluster
39  if (mode == HoeMode::TowersBehindCluster) {
40  // Loop on the basic clusters
41  for (auto it = sc.clustersBegin(); it != sc.clustersEnd(); ++it) {
42  orderedClusters.push_back(*it);
43  }
44  std::sort(orderedClusters.begin(), orderedClusters.end(), [](auto& c1, auto& c2) { return (*c1 > *c2); });
45  unsigned nclusters = orderedClusters.size();
46  for (unsigned iclus = 0; iclus < nclusters && iclus < nMaxClusters; ++iclus) {
47  // Get the tower
48  CaloTowerDetId id = towerOf(*(orderedClusters[iclus]), towerMap);
49 #ifdef EDM_ML_DEBUG
50  std::cout << "CaloTowerId " << id << std::endl;
51 #endif
52  if (std::find(towers.begin(), towers.end(), id) == towers.end()) {
53  towers.push_back(id);
54  }
55  }
56  }
57  // if(towers.size() > 4) {
58  // std::cout << " NTOWERS " << towers.size() << " ";
59  // for(unsigned i=0; i<towers.size() ; ++i) {
60  // std::cout << towers[i] << " ";
61  // }
62  // std::cout << std::endl;
63  // for ( unsigned iclus=0 ; iclus < orderedClusters.size(); ++iclus) {
64  // // Get the tower
65  // CaloTowerDetId id = towerOf(*(orderedClusters[iclus]));
66  // std::cout << " Pos " << orderedClusters[iclus]->position() << " " << orderedClusters[iclus]->energy() << " " << id ;
67  // }
68  // std::cout << std::endl;
69  // }
70  return towers;
71 }

References alignmentValidation::c1, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), gather_cfg::cout, spr::find(), triggerObjects_cff::id, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, reco::SuperCluster::seed(), jetUpdater_cfi::sort, towerOf(), and HLT_FULL_cff::towers.

Referenced by ElectronHcalHelper::hcalTowersBehindClusters(), SuperClusterImporter::importToBlock(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

EgHLTOffHistBins_cfi.eOverP
eOverP
Definition: EgHLTOffHistBins_cfi.py:37
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36379
reco::HitPattern::getHitPattern
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:531
counter
Definition: counter.py:1
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
egamma::HoeMode::SingleTower
edm::Handle::product
T const * product() const
Definition: Handle.h:70
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
mps_update.status
status
Definition: mps_update.py:68
min
T min(T a, T b)
Definition: MathUtil.h:58
HLT_FULL_cff.endcapRecHits
endcapRecHits
Definition: HLT_FULL_cff.py:14947
DetId::det
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DetId::Hcal
Definition: DetId.h:28
ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
HLT_FULL_cff.barrelRecHits
barrelRecHits
Definition: HLT_FULL_cff.py:14946
edm::PtrVectorItr
Definition: PtrVector.h:51
egamma::electronEnergyUncertainty
double electronEnergyUncertainty(reco::GsfElectron::Classification c, double eta, double brem, double energy)
Definition: EnergyUncertaintyElectronSpecific.cc:403
pfMETCorrectionType0_cfi.par1
par1
Definition: pfMETCorrectionType0_cfi.py:48
HcalBarrel
Definition: HcalAssistant.h:33
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
relativeConstraints.error
error
Definition: relativeConstraints.py:53
HcalChannelStatus::HcalCellMask
Definition: HcalChannelStatus.h:18
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EcalBarrel
Definition: EcalSubdetector.h:10
edm::Ref< TrackCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
fileCollector.seed
seed
Definition: fileCollector.py:127
reco::GsfElectron::SHOWERING
Definition: GsfElectron.h:786
DetId
Definition: DetId.h:17
hcaldqm::quantity::fEnergy
Definition: ValueQuantity.h:13
reco::HitPattern
Definition: HitPattern.h:147
HcalChannelStatus::HcalCellOff
Definition: HcalChannelStatus.h:17
edm::soa::col
Definition: KinematicColumns.h:8
pfMETCorrectionType0_cfi.par3
par3
Definition: pfMETCorrectionType0_cfi.py:50
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
PVValHelper::eta
Definition: PVValidationHelpers.h:70
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
hgcalTowerMapProducer_cfi.nBinsEta
nBinsEta
Definition: hgcalTowerMapProducer_cfi.py:10
reco::GsfElectron::GOLDEN
Definition: GsfElectron.h:786
reco::btau::trackMomentum
Definition: TaggingVariable.h:41
MultiGaussianState1D
Definition: MultiGaussianState1D.h:12
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
TrackingRecHit::some
Definition: TrackingRecHit.h:59
egamma::towerOf
CaloTowerDetId towerOf(reco::CaloCluster const &cluster, CaloTowerConstituentsMap const &towerMap)
Definition: EgammaHadTower.cc:10
getGTfromDQMFile.obj
obj
Definition: getGTfromDQMFile.py:32
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
EcalEndcap
Definition: EcalSubdetector.h:10
MuonErrorMatrixAnalyzer_cfi.EtaBins
EtaBins
Definition: MuonErrorMatrixAnalyzer_cfi.py:15
egamma::HoeMode::TowersBehindCluster
TrackingRecHit::all
Definition: TrackingRecHit.h:59
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
pfMETCorrectionType0_cfi.par0
par0
Definition: pfMETCorrectionType0_cfi.py:47
pfMETCorrectionType0_cfi.par2
par2
Definition: pfMETCorrectionType0_cfi.py:49
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
edm::soa::col::Eta
Definition: KinematicColumns.h:10
HcalDetId
Definition: HcalDetId.h:12
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
alignmentValidation.c1
c1
do drawing
Definition: alignmentValidation.py:1025
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
DetId::Ecal
Definition: DetId.h:27
cc
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
egamma::sharedEnergy
float sharedEnergy(reco::CaloCluster const &clu1, reco::CaloCluster const &clu2, EcalRecHitCollection const &barrelRecHits, EcalRecHitCollection const &endcapRecHits)
Definition: EgAmbiguityTools.cc:140
edm::Ptr< CaloCluster >
reco::GsfElectron::BIGBREM
Definition: GsfElectron.h:786
HLT_FULL_cff.fractionShared
fractionShared
Definition: HLT_FULL_cff.py:7044
HcalChannelStatus::HcalCellDead
Definition: HcalChannelStatus.h:20
HcalEndcap
Definition: HcalAssistant.h:34
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
GaussianSumUtilities1D
Definition: GaussianSumUtilities1D.h:16
reco::GsfElectron::GAP
Definition: GsfElectron.h:786
egamma::isBetterElectron
bool isBetterElectron(reco::GsfElectron const &, reco::GsfElectron const &)
Definition: EgAmbiguityTools.cc:16
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
MultiGaussianStateTransform::multiState1D
MultiGaussianState1D multiState1D(const std::vector< MultiGaussianState< N >::Vector > &, const std::vector< MultiGaussianState< N >::Matrix > &, const std::vector< double > &, unsigned int)
Definition: MultiGaussianStateTransform.cc:54
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
reco::GsfElectron::BADTRACK
Definition: GsfElectron.h:786
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
TauDecayModes.dec
dec
Definition: TauDecayModes.py:142
reco::HitPattern::hitPattern
uint16_t hitPattern[ARRAY_LENGTH]
Definition: HitPattern.h:490
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::soa::col::Phi
Definition: KinematicColumns.h:11
CaloTowerDetId
Definition: CaloTowerDetId.h:12