CMS 3D CMS Logo

Classes | Functions
egamma Namespace Reference

Classes

struct  ElectronMomentum
 

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 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)
 
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 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 &)
 

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 * TMath::Sin(2 * TMath::ATan(TMath::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, metsig::electron, HCALHighEnergyHPDFilter_cfi::energy, EgHLTOffHistBins_cfi::et, hcaldqm::quantity::fEnergy, and EcalClusterFunctionBaseClass::getValue().

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 metsig::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, metsig::electron, EgHLTOffHistBins_cfi::eOverP, reco::GsfElectron::GAP, reco::GsfElectron::GOLDEN, GaussianSumUtilities1D::mode(), MultiGaussianStateTransform::multiState1D(), Scenarios_cff::scale, reco::GsfElectron::SHOWERING, mathSSE::sqrt(), reco::btau::trackMomentum, and SingleGaussianState1D::variance().

Referenced by GsfElectronAlgo::createElectron().

◆ electronEnergyUncertainty()

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

Definition at line 402 of file EnergyUncertaintyElectronSpecific.cc.

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

References HltBtagPostValidation_cff::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 
)

Definition at line 17 of file GsfElectronTools.cc.

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

References funct::abs(), TrackingRecHit::all, HLT_2018_cff::dEta, HLT_2018_cff::dPhi, reco::HitPattern::getHitPattern(), reco::HitPattern::hitPattern, min(), pi, reco::HitPattern::pixelHitFilter(), edm::Handle< T >::product(), mathSSE::sqrt(), reco::HitPattern::stripTIBHitFilter(), reco::HitPattern::stripTIDHitFilter(), and reco::HitPattern::TRACK_HITS.

Referenced by GsfElectronAlgo::createElectron(), LowPtGsfElectronCoreProducer::produce(), GsfElectronCoreEcalDrivenProducer::produceEcalDrivenCore(), 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 SurveyInfoScenario_cff::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 SurveyInfoScenario_cff::seed.

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

◆ 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_2018_cff::barrelRecHits, EcalBarrel, EcalEndcap, HLT_2018_cff::endcapRecHits, HLT_2018_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_2018_cff::barrelRecHits, HLT_2018_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 metsig::electron, and relativeConstraints::error.

Referenced by GsfElectronAlgo::createElectron().

EgHLTOffHistBins_cfi.eOverP
eOverP
Definition: EgHLTOffHistBins_cfi.py:37
reco::HitPattern::getHitPattern
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:530
counter
Definition: counter.py:1
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm::Handle::product
T const * product() const
Definition: Handle.h:70
min
T min(T a, T b)
Definition: MathUtil.h:58
edm::PtrVectorItr
Definition: PtrVector.h:51
HLT_2018_cff.endcapRecHits
endcapRecHits
Definition: HLT_2018_cff.py:13538
egamma::electronEnergyUncertainty
double electronEnergyUncertainty(reco::GsfElectron::Classification c, double eta, double brem, double energy)
Definition: EnergyUncertaintyElectronSpecific.cc:402
relativeConstraints.error
error
Definition: relativeConstraints.py:53
EcalBarrel
Definition: EcalSubdetector.h:10
HLT_2018_cff.dEta
dEta
Definition: HLT_2018_cff.py:12289
edm::Ref< TrackCollection >
reco::GsfElectron::SHOWERING
Definition: GsfElectron.h:724
HLT_2018_cff.fractionShared
fractionShared
Definition: HLT_2018_cff.py:5727
hcaldqm::quantity::fEnergy
Definition: ValueQuantity.h:13
reco::HitPattern
Definition: HitPattern.h:147
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
metsig::electron
Definition: SignAlgoResolutions.h:48
HLT_2018_cff.dPhi
dPhi
Definition: HLT_2018_cff.py:12290
reco::GsfElectron::GOLDEN
Definition: GsfElectron.h:724
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
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
edm::LogWarning
Definition: MessageLogger.h:141
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
TrackingRecHit::all
Definition: TrackingRecHit.h:59
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cc
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 >
HLT_2018_cff.barrelRecHits
barrelRecHits
Definition: HLT_2018_cff.py:13541
reco::GsfElectron::BIGBREM
Definition: GsfElectron.h:724
Exception
Definition: hltDiff.cc:246
GaussianSumUtilities1D
Definition: GaussianSumUtilities1D.h:16
reco::GsfElectron::GAP
Definition: GsfElectron.h:724
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
pi
const Double_t pi
Definition: trackSplitPlot.h:36
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
reco::GsfElectron::BADTRACK
Definition: GsfElectron.h:724
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
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
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295