CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions
reco::tau Namespace Reference

Namespaces

 cone
 
 qcuts
 
 xclean
 

Classes

class  Combinatoric
 
class  CombinatoricGenerator
 
class  CombinatoricIterator
 
class  PATTauDiscriminationByMVAIsolationRun2
 
class  PFRecoTauChargedHadronBuilderPlugin
 
class  PFRecoTauChargedHadronFromGenericTrackPlugin
 
class  PFRecoTauChargedHadronFromPFCandidatePlugin
 
class  PFRecoTauChargedHadronQualityPlugin
 
class  PFRecoTauChargedHadronStringQuality
 
class  PFRecoTauDiscriminationByMVAIsolationRun2
 
class  PFRecoTauEnergyAlgorithmPlugin
 
class  PFRecoTauLostTrackPlugin
 
class  PFRecoTauMassPlugin
 
class  RecoTauBuilderCombinatoricPlugin
 
class  RecoTauBuilderConePlugin
 
class  RecoTauBuilderPlugin
 
class  RecoTauChargeCleanerPlugin
 
class  RecoTauChargedHadronMultiplicityCleanerPlugin
 
class  RecoTauCleanerPlugin
 
class  RecoTauConstructor
 
class  RecoTauDiscriminantCleanerPlugin
 
class  RecoTauElectronRejectionPlugin
 
class  RecoTauEnergyRecoveryPlugin2
 
class  RecoTauEventHolderPlugin
 
class  RecoTauImpactParameterSignificancePlugin
 
class  RecoTauLexicographicalRanking
 
class  RecoTauModifierPlugin
 
class  RecoTauNamedPlugin
 
class  RecoTauPiZeroBuilderPlugin
 
class  RecoTauPiZeroCombinatoricPlugin
 
class  RecoTauPiZeroQualityPlugin
 
class  RecoTauPiZeroStringQuality
 
class  RecoTauPiZeroStripPlugin
 
class  RecoTauPiZeroStripPlugin2
 
class  RecoTauPiZeroStripPlugin3
 
class  RecoTauPiZeroTrivialPlugin
 
class  RecoTauQualityCuts
 
class  RecoTauSoftTwoProngTausCleanerPlugin
 
class  RecoTauStringCleanerPlugin
 
class  RecoTauTagInfoWorkaroundModifer
 
class  RecoTauTwoProngFilter
 
class  RecoTauVertexAssociator
 
class  SortPFCandsDescendingPt
 

Typedefs

typedef tau::CombinatoricGenerator< ChargedHadronListChargedHadronCombo
 
typedef std::vector< reco::PFRecoTauChargedHadronChargedHadronList
 
typedef PFRecoTauChargedHadronFromGenericTrackPlugin< pat::PackedCandidatePFRecoTauChargedHadronFromLostTrackPlugin
 
typedef PFRecoTauChargedHadronFromGenericTrackPlugin< reco::TrackPFRecoTauChargedHadronFromTrackPlugin
 
typedef tau::CombinatoricGenerator< PiZeroListPiZeroCombo
 
typedef std::vector< RecoTauPiZeroPiZeroList
 

Enumerations

enum  {
  kOldDMwoLT, kOldDMwLT, kNewDMwoLT, kNewDMwLT,
  kDBoldDMwLT, kDBnewDMwLT, kPWoldDMwLT, kPWnewDMwLT,
  kDBoldDMwLTwGJ, kDBnewDMwLTwGJ, kDBnewDMwLTwGJPhase2
}
 

Functions

math::XYZPointF atECALEntrance (const reco::Candidate *part, double bField)
 
template<typename RefVectorType , typename BaseView >
RefVectorType castView (const edm::Handle< BaseView > &view)
 Convert a BaseView (View<T>) to a TRefVector. More...
 
unsigned int chargedHadronsInDecayMode (PFTau::hadronicDecayMode mode)
 Reverse mapping of decay modes into multiplicities. More...
 
template<typename Container , class OverlapFunction >
Container cleanOverlaps (const Container &dirty)
 
reco::Candidate::LorentzVector compChargedHadronP4fromPThetaPhi (double, double, double)
 
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz (double, double, double)
 
void countHits (const reco::Muon &muon, std::vector< int > &numHitsDT, std::vector< int > &numHitsCSC, std::vector< int > &numHitsRPC)
 
void countMatches (const reco::Muon &muon, std::vector< int > &numMatchesDT, std::vector< int > &numMatchesCSC, std::vector< int > &numMatchesRPC)
 
float eratio (const reco::PFTau &tau)
 return ratio of energy in ECAL over sum of energy in ECAL and HCAL More...
 
float eratio (const pat::Tau &tau)
 
std::pair< edm::ParameterSet, edm::ParameterSetfactorizePUQCuts (const edm::ParameterSet &inputSet)
 
bool fillIsoMVARun2Inputs (float *mvaInput, const pat::Tau &tau, int mvaOpt, const std::string &nameCharged, const std::string &nameNeutral, const std::string &namePu, const std::string &nameOutside, const std::string &nameFootprint)
 
template<typename Iterator >
std::vector< CandidatePtrfilterPFCandidates (const Iterator &begin, const Iterator &end, int pdgId, bool sort=true)
 
std::vector< CandidatePtrflattenPiZeros (const std::vector< RecoTauPiZero >::const_iterator &, const std::vector< RecoTauPiZero >::const_iterator &)
 Flatten a list of pi zeros into a list of there constituent PFCandidates. More...
 
std::vector< CandidatePtrflattenPiZeros (const std::vector< RecoTauPiZero > &)
 
std::string format_vint (const std::vector< int > &vi)
 
PFTau::hadronicDecayMode getDecayMode (const reco::GenJet *genJet)
 
const reco::TrackgetTrackFromChargedHadron (const reco::PFRecoTauChargedHadron &chargedHadron)
 
template<class Base , class Der >
bool isPtrEqual (const edm::Ptr< Base > &b, const edm::Ptr< Der > &d)
 
template<class Base >
bool isPtrEqual (const edm::Ptr< Base > &b, const edm::Ptr< Base > &d)
 
float lead_track_chi2 (const reco::PFTau &tau)
 return chi2 of the leading track ==> deprecated? <== More...
 
template<typename InputIterator >
InputIterator leadCand (InputIterator begin, InputIterator end)
 
unsigned int n_photons_total (const reco::PFTau &tau)
 return total number of pf photon candidates with pT>500 MeV, which are associated to signal More...
 
unsigned int n_photons_total (const pat::Tau &tau)
 
std::vector< CandidatePtrpfCandidates (const Jet &jet, int particleId, bool sort=true)
 
std::vector< CandidatePtrpfCandidates (const Jet &jet, const std::vector< int > &particleIds, bool sort=true)
 Extract pfCandidates of a that match a list of particle Ids from a PFJet. More...
 
std::vector< CandidatePtrpfCandidatesByPdgId (const Jet &jet, int pdgId, bool sort=true)
 
std::vector< CandidatePtrpfCandidatesByPdgId (const Jet &jet, const std::vector< int > &pdgIds, bool sort=true)
 Extract pfCandidates of a that match a list of PDG Ids from a PFJet. More...
 
std::vector< CandidatePtrpfChargedCands (const Jet &jet, bool sort=true)
 Extract all non-neutral candidates from a PFJet. More...
 
std::vector< CandidatePtrpfGammas (const Jet &jet, bool sort=true)
 Extract all pfGammas from a PFJet. More...
 
unsigned int piZerosInDecayMode (PFTau::hadronicDecayMode mode)
 
float pt_weighted_deta_strip (const reco::PFTau &tau, int dm)
 
float pt_weighted_deta_strip (const pat::Tau &tau, int dm)
 
float pt_weighted_dphi_strip (const reco::PFTau &tau, int dm)
 
float pt_weighted_dphi_strip (const pat::Tau &tau, int dm)
 
float pt_weighted_dr_iso (const reco::PFTau &tau, int dm)
 
float pt_weighted_dr_iso (const pat::Tau &tau, int dm)
 
float pt_weighted_dr_signal (const reco::PFTau &tau, int dm)
 
float pt_weighted_dr_signal (const pat::Tau &tau, int dm)
 
float pt_weighted_dx (const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1)
 
float pt_weighted_dx (const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
 
template<typename T >
float pt_weighted_dx_T (const typename T::Tau_t &tau, int mode, int var, int decaymode)
 
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker< edm::ParameterSetDescriptionFiller< PATTauDiscriminationByMVAIsolationRun2 > > s_filler_0__LINE__ ("PATTauDiscriminationByMVAIsolationRun2")
 
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker< edm::ParameterSetDescriptionFiller< PFRecoTauDiscriminationByMVAIsolationRun2 > > s_filler_0__LINE__ ("PFRecoTauDiscriminationByMVAIsolationRun2")
 
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PATTauDiscriminationByMVAIsolationRun2 > > s_maker__LINE__ ("PATTauDiscriminationByMVAIsolationRun2")
 
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PFRecoTauDiscriminationByMVAIsolationRun2 > > s_maker__LINE__ ("PFRecoTauDiscriminationByMVAIsolationRun2")
 
void setChargedHadronP4 (reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
 
template<typename InputIterator >
int sumPFCandCharge (InputIterator begin, InputIterator end)
 Sum the charge of a collection of PFCandidates. More...
 
template<typename InputIterator >
reco::Candidate::LorentzVector sumPFCandP4 (InputIterator begin, InputIterator end)
 
template<typename InputIterator >
double sumPFCandPt (InputIterator begin, InputIterator end)
 Sum the pT of a collection of PFCandidates. More...
 
template<typename InputIterator , typename FunctionPtr , typename ReturnType >
ReturnType sumPFVector (InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
 Sum the four vectors in a collection of PFCandidates. More...
 
template<typename InputIterator >
InputIterator takeNElements (const InputIterator &begin, const InputIterator &end, size_t N)
 
PFTau::hadronicDecayMode translateDecayMode (unsigned int nCharged, unsigned int nPiZero)
 
PFTau::hadronicDecayMode translateGenDecayModeToReco (const std::string &genName)
 Convert a genTau decay mode string ('oneProng0Pi0') to the RECO enum. More...
 
std::string translateRecoDecayModeToGen (PFTau::hadronicDecayMode decayMode)
 Convert a RECO enum decay mode to a string ('oneProng0Pi0') More...
 

Typedef Documentation

◆ ChargedHadronCombo

Definition at line 25 of file RecoTauBuilderCombinatoricPlugin.cc.

◆ ChargedHadronList

Definition at line 24 of file RecoTauBuilderCombinatoricPlugin.cc.

◆ PFRecoTauChargedHadronFromLostTrackPlugin

◆ PFRecoTauChargedHadronFromTrackPlugin

◆ PiZeroCombo

Definition at line 27 of file RecoTauBuilderCombinatoricPlugin.cc.

◆ PiZeroList

typedef std::vector< RecoTauPiZero > reco::tau::PiZeroList

Definition at line 26 of file RecoTauBuilderCombinatoricPlugin.cc.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Function Documentation

◆ atECALEntrance()

math::XYZPointF reco::tau::atECALEntrance ( const reco::Candidate part,
double  bField 
)

Definition at line 109 of file RecoTauCommonUtilities.cc.

References Calorimetry_cff::bField, RawParticle::charge(), BaseParticlePropagator::getSuccess(), BaseParticlePropagator::particle(), reco::PFCandidate::positionAtECALEntrance(), BaseParticlePropagator::propagateToEcalEntrance(), and RawParticle::vertex().

Referenced by reco::tau::PFRecoTauChargedHadronFromPFCandidatePlugin::operator()(), and reco::tau::PFRecoTauChargedHadronFromGenericTrackPlugin< TrackClass >::operator()().

109  {
110  const reco::PFCandidate* pfCand = dynamic_cast<const reco::PFCandidate*>(part);
111  if (pfCand)
112  return pfCand->positionAtECALEntrance();
113 
116  RawParticle(math::XYZTLorentzVector(part->px(), part->py(), part->pz(), part->energy()),
117  math::XYZTLorentzVector(part->vertex().x(), part->vertex().y(), part->vertex().z(), 0.)),
118  part->charge(),
119  0.,
120  0.,
121  bField);
122  theParticle.propagateToEcalEntrance(false);
123  if (theParticle.getSuccess() != 0) {
124  pos = math::XYZPointF(theParticle.particle().vertex());
125  }
126  return pos;
127  }
const math::XYZPointF & positionAtECALEntrance() const
Definition: PFCandidate.h:388
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
Definition: Point3D.h:10
double charge() const
get the MEASURED charge
Definition: RawParticle.h:294
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
RawParticle const & particle() const
The particle being propagated.
bool propagateToEcalEntrance(bool first=true)
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
part
Definition: HCALResponse.h:20
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:320

◆ castView()

template<typename RefVectorType , typename BaseView >
RefVectorType reco::tau::castView ( const edm::Handle< BaseView > &  view)

Convert a BaseView (View<T>) to a TRefVector.

Definition at line 83 of file RecoTauCommonUtilities.h.

References mps_fire::i, convertSQLitetoXML_cfg::output, and relativeConstraints::value.

83  {
84  typedef typename RefVectorType::value_type OutputRef;
85  // Double check at compile time that the inheritance is okay. It can still
86  // fail at runtime if you pass it the wrong collection.
88  RefVectorType output;
89  size_t nElements = view->size();
90  output.reserve(nElements);
91  // Cast each of our Refs
92  for (size_t i = 0; i < nElements; ++i) {
93  output.push_back(view->refAt(i).template castTo<OutputRef>());
94  }
95  return output;
96  }

◆ chargedHadronsInDecayMode()

unsigned int reco::tau::chargedHadronsInDecayMode ( PFTau::hadronicDecayMode  mode)

Reverse mapping of decay modes into multiplicities.

Definition at line 44 of file PFTauDecayModeTools.cc.

References reco::PFTau::kOneProngNPiZero, and mode.

44  {
45  int modeAsInt = static_cast<int>(mode);
46  return (modeAsInt / PFTau::kOneProngNPiZero) + 1;
47  }
reco::PFTau::hadronicDecayMode mode

◆ cleanOverlaps()

template<typename Container , class OverlapFunction >
Container reco::tau::cleanOverlaps ( const Container &  dirty)

Definition at line 31 of file RecoTauCleaningTools.h.

References clean(), and analyzePatCleaning_cfg::overlaps.

31  {
32  // Output container of clean objects
34  OverlapFunction overlapChecker;
35  for (auto const& candidate : dirty) {
36  // Check if this overlaps with a pizero already in the clean list
37  bool overlaps = false;
38  for (auto cleaned = clean.begin(); cleaned != clean.end() && !overlaps; ++cleaned) {
39  overlaps = overlapChecker(candidate, *cleaned);
40  }
41  // If it didn't overlap with anything clean, add it to the clean list
42  if (!overlaps)
43  clean.insert(clean.end(), candidate);
44  }
45  return clean;
46  }
static void clean(char *s)
edm::AssociationVector< reco::JetRefBaseProd, Values > Container

◆ compChargedHadronP4fromPThetaPhi()

reco::Candidate::LorentzVector reco::tau::compChargedHadronP4fromPThetaPhi ( double  chargedHadronP,
double  chargedHadronTheta,
double  chargedHadronPhi 
)

Definition at line 91 of file pfRecoTauChargedHadronAuxFunctions.cc.

References compChargedHadronP4fromPxPyPz().

93  {
94  double chargedHadronPx = chargedHadronP * TMath::Cos(chargedHadronPhi) * TMath::Sin(chargedHadronTheta);
95  double chargedHadronPy = chargedHadronP * TMath::Sin(chargedHadronPhi) * TMath::Sin(chargedHadronTheta);
96  double chargedHadronPz = chargedHadronP * TMath::Cos(chargedHadronTheta);
97  return compChargedHadronP4fromPxPyPz(chargedHadronPx, chargedHadronPy, chargedHadronPz);
98  }
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)

◆ compChargedHadronP4fromPxPyPz()

reco::Candidate::LorentzVector reco::tau::compChargedHadronP4fromPxPyPz ( double  chargedHadronPx,
double  chargedHadronPy,
double  chargedHadronPz 
)

Definition at line 80 of file pfRecoTauChargedHadronAuxFunctions.cc.

References mathSSE::sqrt().

Referenced by compChargedHadronP4fromPThetaPhi(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), and setChargedHadronP4().

82  {
83  const double chargedPionMass = 0.13957; // GeV
84  double chargedHadronEn = sqrt(chargedHadronPx * chargedHadronPx + chargedHadronPy * chargedHadronPy +
85  chargedHadronPz * chargedHadronPz + chargedPionMass * chargedPionMass);
86  reco::Candidate::LorentzVector chargedHadronP4(
87  chargedHadronPx, chargedHadronPy, chargedHadronPz, chargedHadronEn);
88  return chargedHadronP4;
89  }
T sqrt(T t)
Definition: SSEVec.h:19
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36

◆ countHits()

void reco::tau::countHits ( const reco::Muon muon,
std::vector< int > &  numHitsDT,
std::vector< int > &  numHitsCSC,
std::vector< int > &  numHitsRPC 
)

Definition at line 7 of file RecoTauMuonTools.cc.

References TrackingRecHit::bad, reco::HitPattern::getHitPattern(), reco::HitPattern::getHitType(), reco::HitPattern::getMuonStation(), reco::HitPattern::muonCSCHitFilter(), reco::HitPattern::muonDTHitFilter(), reco::HitPattern::muonHitFilter(), reco::HitPattern::muonRPCHitFilter(), reco::HitPattern::numberOfAllHits(), reco::HitPattern::TRACK_HITS, and TrackingRecHit::valid.

10  {
11  if (muon.outerTrack().isNonnull()) {
12  const reco::HitPattern& muonHitPattern = muon.outerTrack()->hitPattern();
13  for (int iHit = 0; iHit < muonHitPattern.numberOfAllHits(reco::HitPattern::TRACK_HITS); ++iHit) {
14  uint32_t hit = muonHitPattern.getHitPattern(reco::HitPattern::TRACK_HITS, iHit);
15  if (hit == 0)
16  break;
17  if (muonHitPattern.muonHitFilter(hit) && (muonHitPattern.getHitType(hit) == TrackingRecHit::valid ||
18  muonHitPattern.getHitType(hit) == TrackingRecHit::bad)) {
19  int muonStation = muonHitPattern.getMuonStation(hit) - 1; // CV: map into range 0..3
20  if (muonStation >= 0 && muonStation < 4) {
21  if (muonHitPattern.muonDTHitFilter(hit))
22  ++numHitsDT[muonStation];
23  else if (muonHitPattern.muonCSCHitFilter(hit))
24  ++numHitsCSC[muonStation];
25  else if (muonHitPattern.muonRPCHitFilter(hit))
26  ++numHitsRPC[muonStation];
27  }
28  }
29  }
30  }
31  }
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:804
static bool muonCSCHitFilter(uint16_t pattern)
Definition: HitPattern.h:645
static uint32_t getHitType(uint16_t pattern)
Definition: HitPattern.h:747
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:537
static bool muonHitFilter(uint16_t pattern)
Definition: HitPattern.h:683
static bool muonDTHitFilter(uint16_t pattern)
Definition: HitPattern.h:636
static uint16_t getMuonStation(uint16_t pattern)
Muon station (1-4). Only valid for muon patterns, of course. only for patterns from muon...
Definition: HitPattern.h:755
static bool muonRPCHitFilter(uint16_t pattern)
Definition: HitPattern.h:654

◆ countMatches()

void reco::tau::countMatches ( const reco::Muon muon,
std::vector< int > &  numMatchesDT,
std::vector< int > &  numMatchesCSC,
std::vector< int > &  numMatchesRPC 
)

Definition at line 46 of file RecoTauMuonTools.cc.

References cms::cuda::assert(), MuonSubdetId::CSC, MuonSubdetId::DT, and MuonSubdetId::RPC.

49  {
50  const std::vector<reco::MuonChamberMatch>& muonSegments = muon.matches();
51  for (std::vector<reco::MuonChamberMatch>::const_iterator muonSegment = muonSegments.begin();
52  muonSegment != muonSegments.end();
53  ++muonSegment) {
54  if (muonSegment->segmentMatches.empty())
55  continue;
56  int muonDetector = muonSegment->detector();
57  int muonStation = muonSegment->station() - 1;
58  assert(muonStation >= 0 && muonStation <= 3);
59  if (muonDetector == MuonSubdetId::DT)
60  ++numMatchesDT[muonStation];
61  else if (muonDetector == MuonSubdetId::CSC)
62  ++numMatchesCSC[muonStation];
63  else if (muonDetector == MuonSubdetId::RPC)
64  ++numMatchesRPC[muonStation];
65  }
66  }
assert(be >=bs)
static constexpr int RPC
Definition: MuonSubdetId.h:13
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12

◆ eratio() [1/2]

float reco::tau::eratio ( const reco::PFTau tau)

return ratio of energy in ECAL over sum of energy in ECAL and HCAL

Definition at line 78 of file PFRecoTauClusterVariables.cc.

References cms::cuda::assert(), pat::PackedCandidate::caloFraction(), reco::PFCandidate::ecalEnergy(), pat::PackedCandidate::energy(), reco::PFCandidate::hcalEnergy(), pat::PackedCandidate::hcalFraction(), metsig::tau, and dqmMemoryStats::total.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

78  {
79  float ecal_en_in_signal_pf_cands = 0;
80  float hcal_en_in_signal_pf_cands = 0;
81  for (const auto& signal_cand : tau.signalCands()) {
82  const reco::PFCandidate* signal_pfcand = dynamic_cast<const reco::PFCandidate*>(signal_cand.get());
83  if (signal_pfcand != nullptr) {
84  ecal_en_in_signal_pf_cands += signal_pfcand->ecalEnergy();
85  hcal_en_in_signal_pf_cands += signal_pfcand->hcalEnergy();
86  } else {
87  // TauReco@MiniAOD: individual ECAL and HCAL energies recovered from fractions
88  const pat::PackedCandidate* signal_pcand = dynamic_cast<const pat::PackedCandidate*>(signal_cand.get());
89  assert(signal_pcand); // Taus are built either from reco::PFCandidates or pat::PackedCandidates
90  float calo_en = signal_pcand->caloFraction() * signal_pcand->energy();
91  ecal_en_in_signal_pf_cands += calo_en * (1. - signal_pcand->hcalFraction());
92  hcal_en_in_signal_pf_cands += calo_en * signal_pcand->hcalFraction();
93  }
94  }
95  float total = ecal_en_in_signal_pf_cands + hcal_en_in_signal_pf_cands;
96  if (total == 0.) {
97  return -1.;
98  }
99  return ecal_en_in_signal_pf_cands / total;
100  }
float caloFraction() const
Set the fraction of ECAL+HCAL energy over candidate energy.
assert(be >=bs)
double hcalEnergy() const
return corrected Hcal energy
Definition: PFCandidate.h:233
double ecalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:221
float hcalFraction() const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
double energy() const override
energy

◆ eratio() [2/2]

float reco::tau::eratio ( const pat::Tau tau)

Definition at line 101 of file PFRecoTauClusterVariables.cc.

References metsig::tau, and dqmMemoryStats::total.

101  {
102  float ecal_en_in_signal_cands = tau.ecalEnergy();
103  float hcal_en_in_signal_cands = tau.hcalEnergy();
104  float total = ecal_en_in_signal_cands + hcal_en_in_signal_cands;
105  if (total == 0.) {
106  return -1.;
107  }
108  return ecal_en_in_signal_cands / total;
109  }

◆ factorizePUQCuts()

std::pair< edm::ParameterSet, edm::ParameterSet > reco::tau::factorizePUQCuts ( const edm::ParameterSet inputSet)

Definition at line 167 of file RecoTauQualityCuts.cc.

References edm::ParameterSet::copyFrom(), DMR_cfg::cut, and input.

Referenced by PFRecoTauDiscriminationByIsolation::PFRecoTauDiscriminationByIsolation(), and PFRecoTauDiscriminationByIsolationContainer::PFRecoTauDiscriminationByIsolationContainer().

167  {
168  edm::ParameterSet puCuts;
169  edm::ParameterSet nonPUCuts;
170 
171  std::vector<std::string> inputNames = input.getParameterNames();
172  for (auto const& cut : inputNames) {
173  if (cut == "minTrackVertexWeight" || cut == "maxDeltaZ" || cut == "maxDeltaZToLeadTrack") {
174  puCuts.copyFrom(input, cut);
175  } else {
176  nonPUCuts.copyFrom(input, cut);
177  }
178  }
179  return std::make_pair(puCuts, nonPUCuts);
180  }
static std::string const input
Definition: EdmProvDump.cc:50
void copyFrom(ParameterSet const &from, std::string const &name)

◆ fillIsoMVARun2Inputs()

bool reco::tau::fillIsoMVARun2Inputs ( float *  mvaInput,
const pat::Tau tau,
int  mvaOpt,
const std::string &  nameCharged,
const std::string &  nameNeutral,
const std::string &  namePu,
const std::string &  nameOutside,
const std::string &  nameFootprint 
)

Definition at line 188 of file PFRecoTauClusterVariables.cc.

References funct::abs(), reco::deltaPhi(), reco::deltaR(), MillePedeFileConverter_cfg::e, eratio(), f, CommonMethods::isnan(), dqmiolumiharvest::j, kDBnewDMwLT, kDBnewDMwLTwGJ, kDBnewDMwLTwGJPhase2, kDBoldDMwLT, kDBoldDMwLTwGJ, kNewDMwLT, kNewDMwoLT, kOldDMwLT, kOldDMwoLT, kPWnewDMwLT, kPWoldDMwLT, dqm-mbProfile::log, SiStripPI::max, SiStripPI::min, taus_updatedMVAIds_cff::mvaOpt, n_photons_total(), l1ctLayer1_cff::nPhoton, funct::pow(), pt_weighted_deta_strip(), pt_weighted_dphi_strip(), pt_weighted_dr_iso(), pt_weighted_dr_signal(), mathSSE::sqrt(), and metsig::tau.

Referenced by reco::tau::PATTauDiscriminationByMVAIsolationRun2::discriminate().

195  {
196  int tauDecayMode = tau.decayMode();
197  const float mTau = 1.77682;
198 
199  if (((mvaOpt == kOldDMwoLT || mvaOpt == kOldDMwLT || mvaOpt == kDBoldDMwLT || mvaOpt == kPWoldDMwLT ||
200  mvaOpt == kDBoldDMwLTwGJ) &&
201  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10)) ||
204  (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 ||
205  tauDecayMode == 10 || tauDecayMode == 11))) {
206  float chargedIsoPtSum = tau.tauID(nameCharged);
207  float neutralIsoPtSum = tau.tauID(nameNeutral);
208  float puCorrPtSum = tau.tauID(namePu);
209  float photonPtSumOutsideSignalCone = tau.tauID(nameOutside);
210  float footprintCorrection = tau.tauID(nameFootprint);
211 
212  float decayDistX = tau.flightLength().x();
213  float decayDistY = tau.flightLength().y();
214  float decayDistZ = tau.flightLength().z();
215  float decayDistMag = std::sqrt(decayDistX * decayDistX + decayDistY * decayDistY + decayDistZ * decayDistZ);
216 
217  // --- The following 5 variables differ slightly between AOD & MiniAOD
218  // because they are recomputed using packedCandidates saved in the tau
220  float ptWeightedDetaStrip = reco::tau::pt_weighted_deta_strip(tau, tauDecayMode);
221  float ptWeightedDphiStrip = reco::tau::pt_weighted_dphi_strip(tau, tauDecayMode);
222  float ptWeightedDrSignal = reco::tau::pt_weighted_dr_signal(tau, tauDecayMode);
223  float ptWeightedDrIsolation = reco::tau::pt_weighted_dr_iso(tau, tauDecayMode);
224  // ---
225  float leadingTrackChi2 = tau.leadingTrackNormChi2();
226  float eRatio = reco::tau::eratio(tau);
227 
228  // Difference between measured and maximally allowed Gottfried-Jackson angle
229  float gjAngleDiff = -999;
230  if (tauDecayMode == 10) {
231  double mAOne = tau.p4().M();
232  double pAOneMag = tau.p();
233  double argumentThetaGJmax = (std::pow(mTau, 2) - std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
234  double argumentThetaGJmeasured =
235  (tau.p4().px() * decayDistX + tau.p4().py() * decayDistY + tau.p4().pz() * decayDistZ) /
236  (pAOneMag * decayDistMag);
237  if (std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1.) {
238  double thetaGJmax = std::asin(argumentThetaGJmax);
239  double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
240  gjAngleDiff = thetaGJmeasured - thetaGJmax;
241  }
242  }
243 
244  if (mvaOpt == kDBnewDMwLTwGJPhase2) {
245  mvaInput[0] = tau.pt();
246  mvaInput[1] = std::abs(tau.eta());
247  mvaInput[2] = chargedIsoPtSum; //tauID("chargedIsoPtSum");
248  mvaInput[3] = neutralIsoPtSum; //tauID("neutralIsoPtSum");
249  mvaInput[4] = puCorrPtSum; //tauID("puCorrPtSum");
250  mvaInput[5] = photonPtSumOutsideSignalCone; //tauID("photonPtSumOutsideSignalCone");
251  mvaInput[6] = tauDecayMode; //tau.decayMode();
252  mvaInput[7] = tau.signalGammaCands().size();
253  mvaInput[8] = tau.isolationGammaCands().size();
254 
255  float sigCands_pt = 0.;
256  float sigCands_dr, sigCands_deta, sigCands_dphi;
257  sigCands_dr = sigCands_deta = sigCands_dphi = 0.;
258  for (const auto& j : tau.signalGammaCands()) {
259  const float dr = reco::deltaR(tau, *j);
260  const float deta = std::abs(tau.eta() - j->eta());
261  const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
262  const float pt_ = j->pt();
263  sigCands_dr += dr * pt_;
264  sigCands_deta += deta * pt_;
265  sigCands_dphi += dphi * pt_;
266  sigCands_pt += pt_;
267  }
268  if (sigCands_pt > 0.) {
269  sigCands_dr = sigCands_dr / sigCands_pt;
270  sigCands_deta = sigCands_deta / sigCands_pt;
271  sigCands_dphi = sigCands_dphi / sigCands_pt;
272  } else {
273  sigCands_dr = sigCands_deta = sigCands_dphi = -0.1;
274  }
275  float isoCands_pt = 0.;
276  float isoCands_dr, isoCands_deta, isoCands_dphi;
277  isoCands_dr = isoCands_deta = isoCands_dphi = 0.;
278  for (const auto& j : tau.isolationGammaCands()) {
279  const float dr = reco::deltaR(tau, *j);
280  const float deta = std::abs(tau.eta() - j->eta());
281  const float dphi = std::abs(reco::deltaPhi(tau.phi(), j->phi()));
282  const float pt_ = j->pt();
283  isoCands_dr += dr * pt_;
284  isoCands_deta += deta * pt_;
285  isoCands_dphi += dphi * pt_;
286  isoCands_pt += pt_;
287  }
288  if (isoCands_pt > 0.) {
289  isoCands_dr = isoCands_dr / isoCands_pt;
290  isoCands_deta = isoCands_deta / isoCands_pt;
291  isoCands_dphi = isoCands_dphi / isoCands_pt;
292  } else {
293  isoCands_dr = isoCands_deta = isoCands_dphi = -0.1;
294  }
295  mvaInput[9] = isoCands_deta;
296  mvaInput[10] = isoCands_dphi;
297  mvaInput[11] = isoCands_dr;
298  mvaInput[12] = sigCands_deta;
299  mvaInput[13] = sigCands_dphi;
300  mvaInput[14] = sigCands_dr;
301 
302  float e = tau.hcalEnergy() + tau.ecalEnergy();
303  e > 0. ? e = tau.ecalEnergy() / e : e = -1.;
304  mvaInput[15] = e;
305  mvaInput[16] = tau.dxy() >= 0. ? +1 : -1;
306  mvaInput[17] = sqrt(std::abs(tau.dxy()));
307  mvaInput[18] = std::abs(tau.dxy_Sig());
308  mvaInput[19] = tau.ip3d() >= 0. ? +1 : -1;
309  mvaInput[20] = sqrt(std::abs(tau.ip3d()));
310  mvaInput[21] = std::abs(tau.ip3d_Sig());
311  mvaInput[22] = (tau.hasSecondaryVertex()) ? 1. : 0.;
312  mvaInput[23] = decayDistMag; //sqrt(tau.flightLength().Mag2());
313  mvaInput[24] = tau.flightLengthSig();
314  mvaInput[25] = leadingTrackChi2; //tau.leadingTrackNormChi2();
315 
316  float thetaGJmax, thetaGJ;
317  if (decayDistMag > 0. && tau.hasSecondaryVertex()) {
318  const float mAOne = tau.p4().M();
319  const float pAOneMag = tau.p();
320  thetaGJmax = (mTau * mTau - mAOne * mAOne) / (2. * mTau * pAOneMag);
321  thetaGJmax = asin(thetaGJmax);
322  thetaGJ = (tau.px() * tau.flightLength().x() + tau.py() * tau.flightLength().y() +
323  tau.pz() * tau.flightLength().z()) /
324  (pAOneMag * decayDistMag);
325  thetaGJ = acos(thetaGJ);
326  if (std::isnan(thetaGJ))
327  thetaGJ = -16.;
328  if (std::isnan(thetaGJmax))
329  thetaGJmax = -11.;
330  } else {
331  thetaGJ = -15.;
332  thetaGJmax = -10.;
333  }
334  mvaInput[26] = thetaGJ - thetaGJmax;
335 
336  mvaInput[27] = 0;
337  mvaInput[28] = 10.;
338  mvaInput[29] = 10.;
339  if (tau.leadChargedHadrCand().isNonnull()) {
340  if (tau.leadChargedHadrCand()->bestTrack()) {
341  const float trackdxy = tau.leadChargedHadrCand()->bestTrack()->dxy();
342  const float trackdxy_err = tau.leadChargedHadrCand()->bestTrack()->dxyError();
343  mvaInput[27] = trackdxy >= 0. ? +1 : -1;
344  mvaInput[28] = sqrt(std::abs(trackdxy));
345  mvaInput[29] = std::abs(trackdxy / trackdxy_err);
346  }
347  }
348  }
349  if (mvaOpt == kOldDMwoLT || mvaOpt == kNewDMwoLT) {
350  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
351  mvaInput[1] = std::abs((float)tau.eta());
352  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
353  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
354  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
355  mvaInput[5] = tauDecayMode;
356  } else if (mvaOpt == kOldDMwLT || mvaOpt == kNewDMwLT) {
357  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
358  mvaInput[1] = std::abs((float)tau.eta());
359  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
360  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f * puCorrPtSum));
361  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
362  mvaInput[5] = tauDecayMode;
363  mvaInput[6] = std::copysign(+1.f, tau.dxy());
364  mvaInput[7] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
365  mvaInput[8] = std::min(10.f, std::abs(tau.dxy_Sig()));
366  mvaInput[9] = (tau.hasSecondaryVertex()) ? 1. : 0.;
367  mvaInput[10] = std::sqrt(decayDistMag);
368  mvaInput[11] = std::min(10.f, tau.flightLengthSig());
369  } else if (mvaOpt == kDBoldDMwLT || mvaOpt == kDBnewDMwLT) {
370  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
371  mvaInput[1] = std::abs((float)tau.eta());
372  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
373  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
374  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
375  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
376  mvaInput[6] = tauDecayMode;
377  mvaInput[7] = std::min(30.f, nPhoton);
378  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
379  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
380  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
381  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
382  mvaInput[12] = std::min(100.f, leadingTrackChi2);
383  mvaInput[13] = std::min(1.f, eRatio);
384  mvaInput[14] = std::copysign(+1.f, tau.dxy());
385  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
386  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
387  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
388  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
389  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
390  mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
391  mvaInput[21] = std::sqrt(decayDistMag);
392  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
393  } else if (mvaOpt == kPWoldDMwLT || mvaOpt == kPWnewDMwLT) {
394  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
395  mvaInput[1] = std::abs((float)tau.eta());
396  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
397  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
398  mvaInput[4] = std::log(std::max(1.e-2f, footprintCorrection));
399  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
400  mvaInput[6] = tauDecayMode;
401  mvaInput[7] = std::min(30.f, nPhoton);
402  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
403  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
404  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
405  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
406  mvaInput[12] = std::min(100.f, leadingTrackChi2);
407  mvaInput[13] = std::min(1.f, eRatio);
408  mvaInput[14] = std::copysign(+1.f, tau.dxy());
409  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
410  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
411  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
412  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
413  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
414  mvaInput[20] = (tau.hasSecondaryVertex()) ? 1. : 0.;
415  mvaInput[21] = std::sqrt(decayDistMag);
416  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
417  } else if (mvaOpt == kDBoldDMwLTwGJ || mvaOpt == kDBnewDMwLTwGJ) {
418  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
419  mvaInput[1] = std::abs((float)tau.eta());
420  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
421  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
422  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
423  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
424  mvaInput[6] = tauDecayMode;
425  mvaInput[7] = std::min(30.f, nPhoton);
426  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
427  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
428  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
429  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
430  mvaInput[12] = std::min(1.f, eRatio);
431  mvaInput[13] = std::copysign(+1.f, tau.dxy());
432  mvaInput[14] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
433  mvaInput[15] = std::min(10.f, std::abs(tau.dxy_Sig()));
434  mvaInput[16] = std::copysign(+1.f, tau.ip3d());
435  mvaInput[17] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
436  mvaInput[18] = std::min(10.f, std::abs(tau.ip3d_Sig()));
437  mvaInput[19] = (tau.hasSecondaryVertex()) ? 1. : 0.;
438  mvaInput[20] = std::sqrt(decayDistMag);
439  mvaInput[21] = std::min(10.f, tau.flightLengthSig());
440  mvaInput[22] = std::max(-1.f, gjAngleDiff);
441  }
442 
443  return true;
444  }
445  return false;
446  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
def isnan(num)
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
double f[11][100]
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ filterPFCandidates()

template<typename Iterator >
std::vector<CandidatePtr> reco::tau::filterPFCandidates ( const Iterator begin,
const Iterator end,
int  pdgId,
bool  sort = true 
)

Filter a collection of objects that are convertible to CandidatePtrs by PFCandidate ID

Definition at line 41 of file RecoTauCommonUtilities.h.

References funct::abs(), convertSQLitetoXML_cfg::output, EgammaValidation_cff::pdgId, and jetUpdater_cfi::sort.

Referenced by pfCandidatesByPdgId(), and pfChargedCands().

44  {
45  std::vector<CandidatePtr> output;
46  for (Iterator iter = begin; iter != end; ++iter) {
47  const reco::CandidatePtr& ptr(*iter);
48  if (std::abs(ptr->pdgId()) == pdgId)
49  output.push_back(ptr);
50  }
51  if (sort)
52  std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
53  return output;
54  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ flattenPiZeros() [1/2]

std::vector< CandidatePtr > reco::tau::flattenPiZeros ( const std::vector< RecoTauPiZero >::const_iterator &  piZerosBegin,
const std::vector< RecoTauPiZero >::const_iterator &  piZerosEnd 
)

Flatten a list of pi zeros into a list of there constituent PFCandidates.

Definition at line 43 of file RecoTauCommonUtilities.cc.

References convertSQLitetoXML_cfg::output.

Referenced by flattenPiZeros(), and reco::tau::xclean::CrossCleanPtrs< PtrIter >::initialize().

44  {
45  std::vector<CandidatePtr> output;
46 
47  for (std::vector<RecoTauPiZero>::const_iterator piZero = piZerosBegin; piZero != piZerosEnd; ++piZero) {
48  for (size_t iDaughter = 0; iDaughter < piZero->numberOfDaughters(); ++iDaughter) {
49  output.push_back(CandidatePtr(piZero->daughterPtr(iDaughter)));
50  }
51  }
52  return output;
53  }
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25

◆ flattenPiZeros() [2/2]

std::vector< CandidatePtr > reco::tau::flattenPiZeros ( const std::vector< RecoTauPiZero > &  piZeros)

Definition at line 55 of file RecoTauCommonUtilities.cc.

References flattenPiZeros().

55  {
56  return flattenPiZeros(piZeros.begin(), piZeros.end());
57  }
std::vector< CandidatePtr > flattenPiZeros(const std::vector< RecoTauPiZero >::const_iterator &, const std::vector< RecoTauPiZero >::const_iterator &)
Flatten a list of pi zeros into a list of there constituent PFCandidates.

◆ format_vint()

std::string reco::tau::format_vint ( const std::vector< int > &  vi)

Definition at line 33 of file RecoTauMuonTools.cc.

References edm::numEntries().

33  {
34  std::ostringstream os;
35  os << "{ ";
36  unsigned numEntries = vi.size();
37  for (unsigned iEntry = 0; iEntry < numEntries; ++iEntry) {
38  os << vi[iEntry];
39  if (iEntry < (numEntries - 1))
40  os << ", ";
41  }
42  os << " }";
43  return os.str();
44  }
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50

◆ getDecayMode()

PFTau::hadronicDecayMode reco::tau::getDecayMode ( const reco::GenJet genJet)

Definition at line 78 of file PFTauDecayModeTools.cc.

References JetMCTagUtils::genTauDecayMode(), reco::PFTau::kNull, and translateGenDecayModeToReco().

78  {
79  if (!genJet)
80  return reco::PFTau::kNull;
82  }
std::string genTauDecayMode(const reco::CompositePtrCandidate &c)
Definition: JetMCTag.cc:70
PFTau::hadronicDecayMode translateGenDecayModeToReco(const std::string &genName)
Convert a genTau decay mode string (&#39;oneProng0Pi0&#39;) to the RECO enum.

◆ getTrackFromChargedHadron()

const reco::Track * reco::tau::getTrackFromChargedHadron ( const reco::PFRecoTauChargedHadron chargedHadron)

Definition at line 12 of file pfRecoTauChargedHadronAuxFunctions.cc.

References pat::PackedCandidate::bestTrack(), and HPSPFTauProducerPuppi_cfi::chargedHadron.

Referenced by reco::tau::RecoTauSoftTwoProngTausCleanerPlugin::operator()(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), PFRecoTauChargedHadronProducer::produce(), and setChargedHadronP4().

12  {
13  // Charged hadron made from track (reco::Track) - RECO/AOD only
14  if (chargedHadron.getTrack().isNonnull()) {
15  return chargedHadron.getTrack().get();
16  }
17  // In MiniAOD, even isolated tracks are saved as candidates, so the track Ptr doesn't exist
18  const pat::PackedCandidate* chargedPFPCand =
19  dynamic_cast<const pat::PackedCandidate*>(chargedHadron.getChargedPFCandidate().get());
20  if (chargedPFPCand != nullptr) {
21  return chargedPFPCand->bestTrack();
22  }
23  const pat::PackedCandidate* lostTrackCand =
24  dynamic_cast<const pat::PackedCandidate*>(chargedHadron.getLostTrackCandidate().get());
25  if (lostTrackCand != nullptr) {
26  return lostTrackCand->bestTrack();
27  }
28  return nullptr;
29  }
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer

◆ isPtrEqual() [1/2]

template<class Base , class Der >
bool reco::tau::isPtrEqual ( const edm::Ptr< Base > &  b,
const edm::Ptr< Der > &  d 
)

Definition at line 94 of file PFRecoTauEnergyAlgorithmPlugin.cc.

References b, and ztail::d.

Referenced by reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()().

94  {
95  return edm::Ptr<Der>(b) == d;
96  }
d
Definition: ztail.py:151
double b
Definition: hdecay.h:118

◆ isPtrEqual() [2/2]

template<class Base >
bool reco::tau::isPtrEqual ( const edm::Ptr< Base > &  b,
const edm::Ptr< Base > &  d 
)

Definition at line 99 of file PFRecoTauEnergyAlgorithmPlugin.cc.

References b, and ztail::d.

99  {
100  return b == d;
101  }
d
Definition: ztail.py:151
double b
Definition: hdecay.h:118

◆ lead_track_chi2()

float reco::tau::lead_track_chi2 ( const reco::PFTau tau)

return chi2 of the leading track ==> deprecated? <==

Definition at line 58 of file PFRecoTauClusterVariables.cc.

References edm::Ptr< T >::get(), pat::PackedCandidate::hasTrackDetails(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), reco::TrackBase::normalizedChi2(), pfDeepBoostedJetPreprocessParams_cfi::pfcand, pat::PackedCandidate::pseudoTrack(), and metsig::tau.

Referenced by reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate().

58  {
59  float LeadingTracknormalizedChi2 = 0;
60  const reco::CandidatePtr& leadingCharged = tau.leadChargedHadrCand();
61  if (leadingCharged.isNonnull()) {
62  const reco::PFCandidate* pfcand = dynamic_cast<const reco::PFCandidate*>(leadingCharged.get());
63  if (pfcand != nullptr) {
64  reco::TrackRef tref = pfcand->trackRef();
65  if (tref.isNonnull()) {
66  LeadingTracknormalizedChi2 = tref->normalizedChi2();
67  }
68  } else {
69  const pat::PackedCandidate* patcand = dynamic_cast<const pat::PackedCandidate*>(leadingCharged.get());
70  if (patcand != nullptr && patcand->hasTrackDetails()) {
71  LeadingTracknormalizedChi2 = patcand->pseudoTrack().normalizedChi2();
72  }
73  }
74  }
75  return LeadingTracknormalizedChi2;
76  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:139
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:593
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
virtual const reco::Track & pseudoTrack() const
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.

◆ leadCand()

template<typename InputIterator >
InputIterator reco::tau::leadCand ( InputIterator  begin,
InputIterator  end 
)

Definition at line 138 of file RecoTauCommonUtilities.h.

Referenced by reco::tau::RecoTauConstructor::get(), reco::tau::RecoTauVertexAssociator::getLeadCand(), reco::tau::RecoTauVertexAssociator::getLeadTrack(), reco::tau::RecoTauVertexAssociator::getLeadTrackRef(), and reco::tau::RecoTauQualityCuts::setLeadTrack().

138  {
139  double max_pt = 0;
140  InputIterator max_cand = begin;
141  for (InputIterator cand = begin; cand != end; ++cand) {
142  if ((*cand)->pt() > max_pt) {
143  max_pt = (*cand)->pt();
144  max_cand = cand;
145  }
146  }
147  return max_cand;
148  }

◆ n_photons_total() [1/2]

unsigned int reco::tau::n_photons_total ( const reco::PFTau tau)

return total number of pf photon candidates with pT>500 MeV, which are associated to signal

Definition at line 163 of file PFRecoTauClusterVariables.cc.

References metsig::tau.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

163  {
164  unsigned int n_photons = 0;
165  for (auto& cand : tau.signalGammaCands()) {
166  if (cand->pt() > 0.5)
167  ++n_photons;
168  }
169  for (auto& cand : tau.isolationGammaCands()) {
170  if (cand->pt() > 0.5)
171  ++n_photons;
172  }
173  return n_photons;
174  }

◆ n_photons_total() [2/2]

unsigned int reco::tau::n_photons_total ( const pat::Tau tau)

Definition at line 175 of file PFRecoTauClusterVariables.cc.

References metsig::tau.

175  {
176  unsigned int n_photons = 0;
177  for (auto& cand : tau.signalGammaCands()) {
178  if (cand->pt() > 0.5)
179  ++n_photons;
180  }
181  for (auto& cand : tau.isolationGammaCands()) {
182  if (cand->pt() > 0.5)
183  ++n_photons;
184  }
185  return n_photons;
186  }

◆ pfCandidates() [1/2]

std::vector< reco::CandidatePtr > reco::tau::pfCandidates ( const Jet jet,
int  particleId,
bool  sort = true 
)

Extract pfCandidates of a given particle Id from a PFJet. If sort is true, candidates will be sorted by descending PT. Internally translates to pdgId

Definition at line 59 of file RecoTauCommonUtilities.cc.

References metsig::jet, pfCandidatesByPdgId(), and jetUpdater_cfi::sort.

Referenced by reco::tau::PFRecoTauChargedHadronFromPFCandidatePlugin::operator()(), reco::tau::RecoTauPiZeroStripPlugin::operator()(), reco::tau::RecoTauPiZeroStripPlugin2::operator()(), reco::tau::RecoTauPiZeroStripPlugin3::operator()(), and pfGammas().

59  {
60  return pfCandidatesByPdgId(jet, translateTypeToAbsPdgId(particleId), sort);
61  }
std::vector< CandidatePtr > pfCandidatesByPdgId(const Jet &jet, int pdgId, bool sort=true)

◆ pfCandidates() [2/2]

std::vector< CandidatePtr > reco::tau::pfCandidates ( const Jet jet,
const std::vector< int > &  particleIds,
bool  sort = true 
)

Extract pfCandidates of a that match a list of particle Ids from a PFJet.

Definition at line 63 of file RecoTauCommonUtilities.cc.

References metsig::jet, CosmicGenFilterHelix_cfi::pdgIds, pfCandidatesByPdgId(), and jetUpdater_cfi::sort.

63  {
64  std::vector<int> pdgIds;
65  pdgIds.reserve(particleIds.size());
66  for (auto particleId : particleIds)
67  pdgIds.push_back(translateTypeToAbsPdgId(particleId));
69  }
std::vector< CandidatePtr > pfCandidatesByPdgId(const Jet &jet, int pdgId, bool sort=true)

◆ pfCandidatesByPdgId() [1/2]

std::vector< reco::CandidatePtr > reco::tau::pfCandidatesByPdgId ( const Jet jet,
int  pdgId,
bool  sort = true 
)

Extract pfCandidates of a given PDG Id from a PFJet. If sort is true, candidates will be sorted by descending PT

Definition at line 71 of file RecoTauCommonUtilities.cc.

References filterPFCandidates(), metsig::jet, EgammaValidation_cff::pdgId, and jetUpdater_cfi::sort.

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), reco::tau::RecoTauBuilderConePlugin::operator()(), and pfCandidates().

71  {
72  CandPtrs pfCands = jet.daughterPtrVector();
73  CandPtrs selectedPFCands = filterPFCandidates(pfCands.begin(), pfCands.end(), pdgId, sort);
74  return selectedPFCands;
75  }
std::vector< reco::CandidatePtr > CandPtrs
std::vector< CandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int pdgId, bool sort=true)

◆ pfCandidatesByPdgId() [2/2]

std::vector< reco::CandidatePtr > reco::tau::pfCandidatesByPdgId ( const Jet jet,
const std::vector< int > &  pdgIds,
bool  sort = true 
)

Extract pfCandidates of a that match a list of PDG Ids from a PFJet.

Definition at line 77 of file RecoTauCommonUtilities.cc.

References filterPFCandidates(), metsig::jet, convertSQLitetoXML_cfg::output, EgammaValidation_cff::pdgId, CosmicGenFilterHelix_cfi::pdgIds, and jetUpdater_cfi::sort.

79  {
80  const CandPtrs& pfCands = jet.daughterPtrVector();
82  // Get each desired candidate type, unsorted for now
83  for (std::vector<int>::const_iterator pdgId = pdgIds.begin(); pdgId != pdgIds.end(); ++pdgId) {
84  CandPtrs&& selectedPFCands = filterPFCandidates(pfCands.begin(), pfCands.end(), *pdgId, false);
85  output.insert(output.end(), selectedPFCands.begin(), selectedPFCands.end());
86  }
87  if (sort)
88  std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
89  return output;
90  }
std::vector< reco::CandidatePtr > CandPtrs
std::vector< CandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int pdgId, bool sort=true)

◆ pfChargedCands()

std::vector< reco::CandidatePtr > reco::tau::pfChargedCands ( const Jet jet,
bool  sort = true 
)

Extract all non-neutral candidates from a PFJet.

Definition at line 94 of file RecoTauCommonUtilities.cc.

References filterPFCandidates(), metsig::jet, convertSQLitetoXML_cfg::output, and jetUpdater_cfi::sort.

Referenced by reco::tau::RecoTauVertexAssociator::getLeadCand(), reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), and reco::tau::RecoTauBuilderConePlugin::operator()().

94  {
95  const CandPtrs& pfCands = jet.daughterPtrVector();
97  CandPtrs&& mus = filterPFCandidates(pfCands.begin(), pfCands.end(), 13, false);
98  CandPtrs&& es = filterPFCandidates(pfCands.begin(), pfCands.end(), 11, false);
99  CandPtrs&& chs = filterPFCandidates(pfCands.begin(), pfCands.end(), 211, false);
100  output.reserve(mus.size() + es.size() + chs.size());
101  output.insert(output.end(), mus.begin(), mus.end());
102  output.insert(output.end(), es.begin(), es.end());
103  output.insert(output.end(), chs.begin(), chs.end());
104  if (sort)
105  std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
106  return output;
107  }
std::vector< reco::CandidatePtr > CandPtrs
std::vector< CandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int pdgId, bool sort=true)

◆ pfGammas()

std::vector< reco::CandidatePtr > reco::tau::pfGammas ( const Jet jet,
bool  sort = true 
)

◆ piZerosInDecayMode()

unsigned int reco::tau::piZerosInDecayMode ( PFTau::hadronicDecayMode  mode)

Definition at line 49 of file PFTauDecayModeTools.cc.

References reco::PFTau::kOneProngNPiZero, and mode.

49  {
50  int modeAsInt = static_cast<int>(mode);
51  return (modeAsInt % PFTau::kOneProngNPiZero);
52  }
reco::PFTau::hadronicDecayMode mode

◆ pt_weighted_deta_strip() [1/2]

float reco::tau::pt_weighted_deta_strip ( const reco::PFTau tau,
int  dm 
)
inline

return sum of pt weighted values of deta relative to tau candidate for all pf photon candidates, which are associated to signal

Definition at line 36 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

36  {
37  return pt_weighted_dx(tau, dm == 10 ? 2 : 1, 1, dm);
38  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_deta_strip() [2/2]

float reco::tau::pt_weighted_deta_strip ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 39 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

39  {
40  return pt_weighted_dx(tau, dm == 10 ? 2 : 1, 1, dm);
41  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dphi_strip() [1/2]

float reco::tau::pt_weighted_dphi_strip ( const reco::PFTau tau,
int  dm 
)
inline

return sum of pt weighted values of dphi relative to tau candidate for all pf photon candidates, which are associated to signal

Definition at line 44 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

44  {
45  return pt_weighted_dx(tau, dm == 10 ? 2 : 1, 2, dm);
46  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dphi_strip() [2/2]

float reco::tau::pt_weighted_dphi_strip ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 47 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

47  {
48  return pt_weighted_dx(tau, dm == 10 ? 2 : 1, 2, dm);
49  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dr_iso() [1/2]

float reco::tau::pt_weighted_dr_iso ( const reco::PFTau tau,
int  dm 
)
inline

return sum of pt weighted values of dr relative to tau candidate for all pf photon candidates, which are inside an isolation conde but not associated to signal

Definition at line 52 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

52 { return pt_weighted_dx(tau, 2, 0, dm); }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dr_iso() [2/2]

float reco::tau::pt_weighted_dr_iso ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 53 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

53 { return pt_weighted_dx(tau, 2, 0, dm); }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dr_signal() [1/2]

float reco::tau::pt_weighted_dr_signal ( const reco::PFTau tau,
int  dm 
)
inline

return sum of pt weighted values of dr relative to tau candidate for all pf photon candidates, which are associated to signal

Definition at line 32 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

Referenced by DeepTauId::createTauBlockInputs(), reco::tau::PFRecoTauDiscriminationByMVAIsolationRun2::discriminate(), and fillIsoMVARun2Inputs().

32 { return pt_weighted_dx(tau, 0, 0, dm); }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dr_signal() [2/2]

float reco::tau::pt_weighted_dr_signal ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 33 of file PFRecoTauClusterVariables.h.

References symbols::dm, pt_weighted_dx(), and metsig::tau.

33 { return pt_weighted_dx(tau, 0, 0, dm); }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)

◆ pt_weighted_dx() [1/2]

float reco::tau::pt_weighted_dx ( const reco::PFTau tau,
int  mode = 0,
int  var = 0,
int  decaymode = -1 
)

return sum of pt weighted values of distance to tau candidate for all pf photon candidates, which are associated to signal; depending on var the distance is in 0=:dr, 1=:deta, 2=:dphi

Definition at line 156 of file PFRecoTauClusterVariables.cc.

References runTauDisplay::decaymode, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, metsig::tau, and trigObjTnPSource_cfi::var.

Referenced by pt_weighted_deta_strip(), pt_weighted_dphi_strip(), pt_weighted_dr_iso(), and pt_weighted_dr_signal().

◆ pt_weighted_dx() [2/2]

float reco::tau::pt_weighted_dx ( const pat::Tau tau,
int  mode = 0,
int  var = 0,
int  decaymode = -1 
)

◆ pt_weighted_dx_T()

template<typename T >
float reco::tau::pt_weighted_dx_T ( const typename T::Tau_t &  tau,
int  mode,
int  var,
int  decaymode 
)

return sum of pt weighted values of distance to tau candidate for all pf photon candidates, which are associated to signal; depending on var the distance is in 0=:dr, 1=:deta, 2=:dphi

Definition at line 113 of file PFRecoTauClusterVariables.cc.

References funct::abs(), HLT_2022v15_cff::cands, runTauDisplay::decaymode, reco::deltaPhi(), reco::deltaR(), RemoveAddSevLevel::flag, SiStripPI::max, SiStripPI::min, ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, DiDispStaMuonMonitor_cfi::pt, metsig::tau, and trigObjTnPSource_cfi::var.

113  {
114  float sum_pt = 0.;
115  float sum_dx_pt = 0.;
116  float signalrad = std::max(0.05, std::min(0.1, 3. / std::max(1., tau.pt())));
117  int is3prong = (decaymode == 10);
118  const auto& cands = getGammas_T<T>(tau, mode < 2);
119  for (const auto& cand : cands) {
120  // only look at electrons/photons with pT > 0.5
121  if (cand->pt() < 0.5) {
122  continue;
123  }
124  float dr = reco::deltaR(cand->eta(), cand->phi(), tau.eta(), tau.phi());
125  float deta = std::abs(cand->eta() - tau.eta());
126  float dphi = std::abs(reco::deltaPhi(cand->phi(), tau.phi()));
127  float pt = cand->pt();
128  bool flag = isInside(pt, deta, dphi);
129  if (is3prong == 0) {
130  if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
131  sum_pt += pt;
132  if (var == 0)
133  sum_dx_pt += pt * dr;
134  else if (var == 1)
135  sum_dx_pt += pt * deta;
136  else if (var == 2)
137  sum_dx_pt += pt * dphi;
138  }
139  } else if (is3prong == 1) {
140  if ((mode == 2 && flag == false) || (mode == 1 && flag == true) || mode == 0) {
141  sum_pt += pt;
142  if (var == 0)
143  sum_dx_pt += pt * dr;
144  else if (var == 1)
145  sum_dx_pt += pt * deta;
146  else if (var == 2)
147  sum_dx_pt += pt * dphi;
148  }
149  }
150  }
151  if (sum_pt > 0.) {
152  return sum_dx_pt / sum_pt;
153  }
154  return 0.;
155  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30

◆ s_filler_0__LINE__() [1/2]

static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< PATTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_filler_0__LINE__ ( "PATTauDiscriminationByMVAIsolationRun2"  )
static

◆ s_filler_0__LINE__() [2/2]

static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< PFRecoTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_filler_0__LINE__ ( "PFRecoTauDiscriminationByMVAIsolationRun2"  )
static

◆ s_maker__LINE__() [1/2]

static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PATTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_maker__LINE__ ( "PATTauDiscriminationByMVAIsolationRun2"  )
static

◆ s_maker__LINE__() [2/2]

static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PFRecoTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_maker__LINE__ ( "PFRecoTauDiscriminationByMVAIsolationRun2"  )
static

◆ setChargedHadronP4()

void reco::tau::setChargedHadronP4 ( reco::PFRecoTauChargedHadron chargedHadron,
double  scaleFactor_neutralPFCands = 1.0 
)

Definition at line 31 of file pfRecoTauChargedHadronAuxFunctions.cc.

References cms::cuda::assert(), HPSPFTauProducerPuppi_cfi::chargedHadron, compChargedHadronP4fromPxPyPz(), getTrackFromChargedHadron(), edm::Ptr< T >::isNonnull(), reco::PFRecoTauChargedHadron::kChargedPFCandidate, reco::PFRecoTauChargedHadron::kPFNeutralHadron, reco::PFRecoTauChargedHadron::kTrack, electrons_cff::ptRatio, and HLT_2022v15_cff::track.

Referenced by reco::tau::RecoTauConstructor::addTauChargedHadron(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), reco::tau::PFRecoTauChargedHadronFromPFCandidatePlugin::operator()(), reco::tau::PFRecoTauChargedHadronFromGenericTrackPlugin< TrackClass >::operator()(), and PFRecoTauChargedHadronProducer::produce().

31  {
32  double chargedHadronP = 0.;
33  double chargedHadronPx = 0.;
34  double chargedHadronPy = 0.;
35  double chargedHadronPz = 0.;
36  double SumNeutrals = 0.;
39  const reco::CandidatePtr& chargedPFCand = chargedHadron.getChargedPFCandidate();
40  assert(chargedPFCand.isNonnull());
41  chargedHadronP += chargedPFCand->p();
42  chargedHadronPx = chargedPFCand->px();
43  chargedHadronPy = chargedPFCand->py();
44  chargedHadronPz = chargedPFCand->pz();
47  if (track != nullptr) {
48  chargedHadronP += track->p();
49  chargedHadronPx = track->px();
50  chargedHadronPy = track->py();
51  chargedHadronPz = track->pz();
52  } else { // lost tracks from MiniAOD that don't have track information saved
53  const reco::CandidatePtr& lostTrack = chargedHadron.getLostTrackCandidate();
54  assert(lostTrack.isNonnull());
55  chargedHadronP += lostTrack->p();
56  chargedHadronPx = lostTrack->px();
57  chargedHadronPy = lostTrack->py();
58  chargedHadronPz = lostTrack->pz();
59  }
60  } else
61  assert(0);
62  const std::vector<reco::CandidatePtr>& neutralPFCands = chargedHadron.getNeutralPFCandidates();
63  for (std::vector<reco::CandidatePtr>::const_iterator neutralPFCand = neutralPFCands.begin();
64  neutralPFCand != neutralPFCands.end();
65  ++neutralPFCand) {
66  SumNeutrals += (*neutralPFCand)->p();
67  }
68  double noNeutrals = chargedHadronP;
69  chargedHadronP += scaleFactor_neutralPFCands * SumNeutrals;
70  double ptRatio = chargedHadronP / noNeutrals;
71  chargedHadronPx *= ptRatio;
72  chargedHadronPy *= ptRatio;
73  chargedHadronPz *= ptRatio;
74 
75  reco::Candidate::LorentzVector chargedHadronP4 =
76  compChargedHadronP4fromPxPyPz(chargedHadronPx, chargedHadronPy, chargedHadronPz);
77  chargedHadron.setP4(chargedHadronP4);
78  }
assert(be >=bs)
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
const reco::Track * getTrackFromChargedHadron(const reco::PFRecoTauChargedHadron &chargedHadron)
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)

◆ sumPFCandCharge()

template<typename InputIterator >
int reco::tau::sumPFCandCharge ( InputIterator  begin,
InputIterator  end 
)

Sum the charge of a collection of PFCandidates.

Definition at line 133 of file RecoTauCommonUtilities.h.

References reco::Candidate::charge(), and sumPFVector().

133  {
134  return sumPFVector(begin, end, &Candidate::charge, 0);
135  }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.

◆ sumPFCandP4()

template<typename InputIterator >
reco::Candidate::LorentzVector reco::tau::sumPFCandP4 ( InputIterator  begin,
InputIterator  end 
)

Definition at line 121 of file RecoTauCommonUtilities.h.

References reco::Candidate::p4(), and sumPFVector().

121  {
122  return sumPFVector(begin, end, &Candidate::p4, reco::Candidate::LorentzVector());
123  }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36

◆ sumPFCandPt()

template<typename InputIterator >
double reco::tau::sumPFCandPt ( InputIterator  begin,
InputIterator  end 
)

Sum the pT of a collection of PFCandidates.

Definition at line 127 of file RecoTauCommonUtilities.h.

References reco::Candidate::pt(), and sumPFVector().

Referenced by reco::tau::RecoTauConstructor::get().

127  {
128  return sumPFVector(begin, end, &Candidate::pt, 0.0);
129  }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.

◆ sumPFVector()

template<typename InputIterator , typename FunctionPtr , typename ReturnType >
ReturnType reco::tau::sumPFVector ( InputIterator  begin,
InputIterator  end,
FunctionPtr  func,
ReturnType  init 
)

Sum the four vectors in a collection of PFCandidates.

Definition at line 111 of file RecoTauCommonUtilities.h.

References EcalMonitorTask_cff::func, init, and convertSQLitetoXML_cfg::output.

Referenced by sumPFCandCharge(), sumPFCandP4(), and sumPFCandPt().

111  {
113  for (InputIterator cand = begin; cand != end; ++cand) {
114  //#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
115  output += ((**cand).*(func))();
116  }
117  return output;
118  }
int init
Definition: HydjetWrapper.h:64
std::map< DetId, double > ReturnType

◆ takeNElements()

template<typename InputIterator >
InputIterator reco::tau::takeNElements ( const InputIterator &  begin,
const InputIterator &  end,
size_t  N 
)

◆ translateDecayMode()

PFTau::hadronicDecayMode reco::tau::translateDecayMode ( unsigned int  nCharged,
unsigned int  nPiZero 
)

Definition at line 54 of file PFTauDecayModeTools.cc.

References reco::PFTau::kNull, reco::PFTau::kOneProngNPiZero, reco::PFTau::kRareDecayMode, HLT_2022v15_cff::maxPiZeros, HLT_2022v15_cff::nCharged, and HLT_2022v15_cff::nPiZeros.

54  {
55  // If no tracks exist, this is definitely not a tau!
56  if (!nCharged)
57  return PFTau::kNull;
58  // Find the maximum number of PiZeros our parameterization can hold
59  const unsigned int maxPiZeros = PFTau::kOneProngNPiZero;
60  // Determine our track index
61  unsigned int trackIndex = (nCharged - 1) * (maxPiZeros + 1);
62  // Check if we handle the given number of tracks
63  if (trackIndex >= PFTau::kRareDecayMode)
64  return PFTau::kRareDecayMode;
65 
67  return static_cast<PFTau::hadronicDecayMode>(trackIndex + nPiZeros);
68  }

◆ translateGenDecayModeToReco()

PFTau::hadronicDecayMode reco::tau::translateGenDecayModeToReco ( const std::string &  genName)

Convert a genTau decay mode string ('oneProng0Pi0') to the RECO enum.

Definition at line 70 of file PFTauDecayModeTools.cc.

References Skims_PA_cff::name.

Referenced by getDecayMode().

70  {
71  return decayModeStringToId(name.c_str(), dmTranslatorMap);
72  }

◆ translateRecoDecayModeToGen()

std::string reco::tau::translateRecoDecayModeToGen ( PFTau::hadronicDecayMode  decayMode)

Convert a RECO enum decay mode to a string ('oneProng0Pi0')

Definition at line 74 of file PFTauDecayModeTools.cc.

References boostedTaus_cff::decayMode.

74  {
75  return decayModeIdToString(decayMode, dmTranslatorMap);
76  }