CMS 3D CMS Logo

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

Namespaces

 cone
 
 disc
 
 helpers
 
 qcuts
 
 xclean
 

Classes

class  AssociationMatchRefSelector
 
class  Combinatoric
 
class  CombinatoricGenerator
 
class  CombinatoricIterator
 
class  PATTauDiscriminationByMVAIsolationRun2
 
class  PFRecoTauChargedHadronBuilderPlugin
 
class  PFRecoTauChargedHadronFromPFCandidatePlugin
 
class  PFRecoTauChargedHadronFromTrackPlugin
 
class  PFRecoTauChargedHadronQualityPlugin
 
class  PFRecoTauChargedHadronStringQuality
 
class  PFRecoTauDiscriminationByMVAIsolationRun2
 
class  PFRecoTauEnergyAlgorithmPlugin
 
class  PFRecoTauMassPlugin
 
class  RecoTauBuilderCombinatoricPlugin
 
class  RecoTauBuilderConePlugin
 
class  RecoTauBuilderPlugin
 
class  RecoTauChargeCleanerPlugin
 
class  RecoTauChargedHadronMultiplicityCleanerPlugin
 
class  RecoTauCleanerPlugin
 
class  RecoTauConstructor
 
class  RecoTauDiscriminantCleanerPlugin
 
class  RecoTauDiscriminantFromDiscriminator
 
class  RecoTauDiscriminantFunctionPlugin
 
class  RecoTauDiscriminantInvariantWidth
 
class  RecoTauDiscriminantPlugin
 
class  RecoTauDiscriminantVectorFunctionPlugin
 
class  RecoTauDiscriminationBinnedIsolation
 
class  RecoTauDiscriminationBinnedIsolationImpl
 
class  RecoTauElectronRejectionPlugin
 
class  RecoTauEnergyRecoveryPlugin2
 
class  RecoTauEventHolderPlugin
 
class  RecoTauImpactParameterSignificancePlugin
 
class  RecoTauIsolationMasking
 
class  RecoTauLexicographicalRanking
 
class  RecoTauModifierPlugin
 
class  RecoTauNamedPlugin
 
class  RecoTauObjectEmbedder
 
class  RecoTauPhotonFilter
 
class  RecoTauPiZeroBuilderPlugin
 
class  RecoTauPiZeroCombinatoricPlugin
 
class  RecoTauPiZeroQualityPlugin
 
class  RecoTauPiZeroStringQuality
 
class  RecoTauPiZeroStripPlugin
 
class  RecoTauPiZeroStripPlugin2
 
class  RecoTauPiZeroStripPlugin3
 
class  RecoTauPiZeroTrivialPlugin
 
class  RecoTauQualityCuts
 
class  RecoTauRandomCleanerPlugin
 
class  RecoTauSoftTwoProngTausCleanerPlugin
 
class  RecoTauStringCleanerPlugin
 
class  RecoTauTagInfoWorkaroundModifer
 
class  RecoTauTwoProngFilter
 
class  RecoTauVertexAssociator
 
class  SortByDescendingPt
 
class  SortPFCandsDescendingPt
 

Typedefs

typedef tau::CombinatoricGenerator< ChargedHadronListChargedHadronCombo
 
typedef std::vector< reco::PFRecoTauChargedHadronChargedHadronList
 
typedef tau::CombinatoricGenerator< PiZeroListPiZeroCombo
 
typedef std::vector< RecoTauPiZeroPiZeroList
 

Enumerations

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

Functions

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)
 
std::string discPluginName (const std::string &mvaName)
 
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< PFCandidatePtrfilterPFCandidates (const Iterator &begin, const Iterator &end, int particleId, bool sort=true)
 
std::vector< PFCandidatePtrflattenPiZeros (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< PFCandidatePtrflattenPiZeros (const std::vector< RecoTauPiZero > &)
 
PFTau::hadronicDecayMode getDecayMode (const reco::GenJet *genJet)
 
float lead_track_chi2 (const reco::PFTau &tau)
 return chi2 of the leading track ==> deprecated? <== More...
 
template<typename InputIterator >
InputIterator leadPFCand (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< PFCandidatePtrpfCandidates (const PFJet &jet, int particleId, bool sort=true)
 
std::vector< PFCandidatePtrpfCandidates (const PFJet &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< PFCandidatePtrpfChargedCands (const PFJet &jet, bool sort=true)
 Extract all non-neutral candidates from a PFJet. More...
 
std::vector< PFCandidatePtrpfGammas (const PFJet &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__LINE__ ("PATTauDiscriminationByMVAIsolationRun2")
 
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker< edm::ParameterSetDescriptionFiller< PFRecoTauDiscriminationByMVAIsolationRun2 > > s_filler__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

Definition at line 24 of file RecoTauBuilderCombinatoricPlugin.cc.

Definition at line 23 of file RecoTauBuilderCombinatoricPlugin.cc.

Definition at line 26 of file RecoTauBuilderCombinatoricPlugin.cc.

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

Definition at line 25 of file RecoTauBuilderCombinatoricPlugin.cc.

Enumeration Type Documentation

anonymous enum

Function Documentation

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 73 of file RecoTauCommonUtilities.h.

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

73  {
74  typedef typename RefVectorType::value_type OutputRef;
75  // Double check at compile time that the inheritance is okay. It can still
76  // fail at runtime if you pass it the wrong collection.
77  static_assert(
78  (boost::is_base_of<typename BaseView::value_type,
79  typename RefVectorType::member_type>::value));
80  RefVectorType output;
81  size_t nElements = view->size();
82  output.reserve(nElements);
83  // Cast each of our Refs
84  for (size_t i = 0; i < nElements; ++i) {
85  output.push_back(view->refAt(i).template castTo<OutputRef>());
86  }
87  return output;
88 }
Definition: value.py:1
unsigned int reco::tau::chargedHadronsInDecayMode ( PFTau::hadronicDecayMode  mode)

Reverse mapping of decay modes into multiplicities.

Definition at line 45 of file PFTauDecayModeTools.cc.

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

45  {
46  int modeAsInt = static_cast<int>(mode);
47  return (modeAsInt / PFTau::kOneProngNPiZero) + 1;
48 }
reco::PFTau::hadronicDecayMode mode
template<typename Container , class OverlapFunction >
Container reco::tau::cleanOverlaps ( const Container &  dirty)

Definition at line 33 of file RecoTauCleaningTools.h.

References clean, and analyzePatCleaning_cfg::overlaps.

33  {
34  typedef typename Container::const_iterator Iterator;
35  // Output container of clean objects
37  OverlapFunction overlapChecker;
38  for (Iterator candidate = dirty.begin(); candidate != dirty.end();
39  ++candidate) {
40  // Check if this overlaps with a pizero already in the clean list
41  bool overlaps = false;
42  for (Iterator cleaned = clean.begin();
43  cleaned != clean.end() && !overlaps; ++cleaned) {
44  overlaps = overlapChecker(*candidate, *cleaned);
45  }
46  // If it didn't overlap with anything clean, add it to the clean list
47  if (!overlaps)
48  clean.insert(clean.end(), *candidate);
49  }
50  return clean;
51 }
std::vector< T * > clean
Definition: MVATrainer.cc:154
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
reco::Candidate::LorentzVector reco::tau::compChargedHadronP4fromPThetaPhi ( double  chargedHadronP,
double  chargedHadronTheta,
double  chargedHadronPhi 
)

Definition at line 58 of file pfRecoTauChargedHadronAuxFunctions.cc.

References compChargedHadronP4fromPxPyPz().

59 {
60  double chargedHadronPx = chargedHadronP*TMath::Cos(chargedHadronPhi)*TMath::Sin(chargedHadronTheta);
61  double chargedHadronPy = chargedHadronP*TMath::Sin(chargedHadronPhi)*TMath::Sin(chargedHadronTheta);
62  double chargedHadronPz = chargedHadronP*TMath::Cos(chargedHadronTheta);
63  return compChargedHadronP4fromPxPyPz(chargedHadronPx, chargedHadronPy, chargedHadronPz);
64 }
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)
reco::Candidate::LorentzVector reco::tau::compChargedHadronP4fromPxPyPz ( double  chargedHadronPx,
double  chargedHadronPy,
double  chargedHadronPz 
)

Definition at line 50 of file pfRecoTauChargedHadronAuxFunctions.cc.

References mathSSE::sqrt().

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

51 {
52  const double chargedPionMass = 0.13957; // GeV
53  double chargedHadronEn = sqrt(chargedHadronPx*chargedHadronPx + chargedHadronPy*chargedHadronPy + chargedHadronPz*chargedHadronPz + chargedPionMass*chargedPionMass);
54  reco::Candidate::LorentzVector chargedHadronP4(chargedHadronPx, chargedHadronPy, chargedHadronPz, chargedHadronEn);
55  return chargedHadronP4;
56 }
T sqrt(T t)
Definition: SSEVec.h:18
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
std::string reco::tau::discPluginName ( const std::string &  mvaName)
inline
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 57 of file PFRecoTauClusterVariables.cc.

References reco::PFTau::signalPFCands(), and pileupDistInMC::total.

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

57  {
58  float ecal_en_in_signal_pf_cands = 0;
59  float hcal_en_in_signal_pf_cands = 0;
60  for (const auto& signal_cand : tau.signalPFCands()) {
61  ecal_en_in_signal_pf_cands += signal_cand->ecalEnergy();
62  hcal_en_in_signal_pf_cands += signal_cand->hcalEnergy();
63  }
64  float total = ecal_en_in_signal_pf_cands + hcal_en_in_signal_pf_cands;
65  if(total==0){
66  return -1;
67  }
68  return ecal_en_in_signal_pf_cands/total;
69  }
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
float reco::tau::eratio ( const pat::Tau tau)

Definition at line 70 of file PFRecoTauClusterVariables.cc.

References pat::Tau::ecalEnergy(), pat::Tau::hcalEnergy(), and pileupDistInMC::total.

70  {
71  float ecal_en_in_signal_cands = tau.ecalEnergy();
72  float hcal_en_in_signal_cands = tau.hcalEnergy();
73  float total = ecal_en_in_signal_cands + hcal_en_in_signal_cands;
74  if(total == 0){
75  return -1;
76  }
77  return ecal_en_in_signal_cands/total;
78  }
float hcalEnergy() const
return sum of hcal energies from signal candidates
Definition: Tau.h:336
float ecalEnergy() const
Definition: Tau.h:334
std::pair< edm::ParameterSet, edm::ParameterSet > reco::tau::factorizePUQCuts ( const edm::ParameterSet inputSet)

Definition at line 315 of file RecoTauQualityCuts.cc.

References edm::ParameterSet::copyFrom(), TkAlMuonSelectors_cfi::cut, and edm::ParameterSet::getParameterNames().

Referenced by PFRecoTauDiscriminationByIsolation::PFRecoTauDiscriminationByIsolation().

316 {
317  edm::ParameterSet puCuts;
318  edm::ParameterSet nonPUCuts;
319 
320  std::vector<std::string> inputNames = input.getParameterNames();
321  for(auto const& cut : inputNames ) {
322  if ( cut == "minTrackVertexWeight" ||
323  cut == "maxDeltaZ" ||
324  cut == "maxDeltaZToLeadTrack" ) {
325  puCuts.copyFrom(input, cut);
326  } else {
327  nonPUCuts.copyFrom(input, cut);
328  }
329  }
330  return std::make_pair(puCuts, nonPUCuts);
331 }
static std::string const input
Definition: EdmProvDump.cc:45
void copyFrom(ParameterSet const &from, std::string const &name)
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 158 of file PFRecoTauClusterVariables.cc.

References funct::abs(), tauProducer_cfi::chargedIsoPtSum, pat::Tau::decayMode(), pat::Tau::dxy(), pat::Tau::dxy_Sig(), MillePedeFileConverter_cfg::e, eratio(), reco::LeafCandidate::eta(), f, pat::Tau::flightLength(), pat::Tau::flightLengthSig(), tauProducer_cfi::footprintCorrection, pat::Tau::hasSecondaryVertex(), pat::Tau::ip3d(), pat::Tau::ip3d_Sig(), kDBnewDMwLT, kDBnewDMwLTwGJ, kDBoldDMwLT, kDBoldDMwLTwGJ, kNewDMwLT, kNewDMwoLT, kOldDMwLT, kOldDMwoLT, kPWnewDMwLT, kPWoldDMwLT, pat::Tau::leadingTrackNormChi2(), cmsBatch::log, SiStripPI::max, min(), n_photons_total(), tauProducer_cfi::neutralIsoPtSum, reco::LeafCandidate::p(), reco::LeafCandidate::p4(), tauProducer_cfi::photonPtSumOutsideSignalCone, funct::pow(), reco::LeafCandidate::pt(), pt_weighted_deta_strip(), pt_weighted_dphi_strip(), pt_weighted_dr_iso(), pt_weighted_dr_signal(), tauProducer_cfi::puCorrPtSum, mathSSE::sqrt(), and pat::Tau::tauID().

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

161  {
162  int tauDecayMode = tau.decayMode();
163 
165  && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 10))
166  ||
168  && (tauDecayMode == 0 || tauDecayMode == 1 || tauDecayMode == 2 || tauDecayMode == 5 || tauDecayMode == 6 || tauDecayMode == 10 || tauDecayMode == 11))
169  ) {
170 
171  float chargedIsoPtSum = tau.tauID(nameCharged);
172  float neutralIsoPtSum = tau.tauID(nameNeutral);
173  float puCorrPtSum = tau.tauID(namePu);
174  float photonPtSumOutsideSignalCone = tau.tauID(nameOutside);
175  float footprintCorrection = tau.tauID(nameFootprint);
176 
177  float decayDistX = tau.flightLength().x();
178  float decayDistY = tau.flightLength().y();
179  float decayDistZ = tau.flightLength().z();
180  float decayDistMag = std::sqrt(decayDistX*decayDistX + decayDistY*decayDistY + decayDistZ*decayDistZ);
181 
182  // --- The following 5 variables differ slightly between AOD & MiniAOD
183  // because they are recomputed using packedCandidates saved in the tau
184  float nPhoton = reco::tau::n_photons_total(tau);
185  float ptWeightedDetaStrip = reco::tau::pt_weighted_deta_strip(tau, tauDecayMode);
186  float ptWeightedDphiStrip = reco::tau::pt_weighted_dphi_strip(tau, tauDecayMode);
187  float ptWeightedDrSignal = reco::tau::pt_weighted_dr_signal(tau, tauDecayMode);
188  float ptWeightedDrIsolation = reco::tau::pt_weighted_dr_iso(tau, tauDecayMode);
189  // ---
190  float leadingTrackChi2 = tau.leadingTrackNormChi2();
191  float eRatio = reco::tau::eratio(tau);
192 
193  // Difference between measured and maximally allowed Gottfried-Jackson angle
194  float gjAngleDiff = -999;
195  if ( tauDecayMode == 10 ) {
196  double mTau = 1.77682;
197  double mAOne = tau.p4().M();
198  double pAOneMag = tau.p();
199  double argumentThetaGJmax = (std::pow(mTau,2) - std::pow(mAOne,2) ) / ( 2 * mTau * pAOneMag );
200  double argumentThetaGJmeasured = ( tau.p4().px() * decayDistX + tau.p4().py() * decayDistY + tau.p4().pz() * decayDistZ ) / ( pAOneMag * decayDistMag );
201  if ( std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1. ) {
202  double thetaGJmax = std::asin( argumentThetaGJmax );
203  double thetaGJmeasured = std::acos( argumentThetaGJmeasured );
204  gjAngleDiff = thetaGJmeasured - thetaGJmax;
205  }
206  }
207 
208  if ( mvaOpt == kOldDMwoLT || mvaOpt == kNewDMwoLT ) {
209  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
210  mvaInput[1] = std::abs((float)tau.eta());
211  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
212  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f*puCorrPtSum));
213  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
214  mvaInput[5] = tauDecayMode;
215  } else if ( mvaOpt == kOldDMwLT || mvaOpt == kNewDMwLT ) {
216  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
217  mvaInput[1] = std::abs((float)tau.eta());
218  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
219  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum - 0.125f*puCorrPtSum));
220  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
221  mvaInput[5] = tauDecayMode;
222  mvaInput[6] = std::copysign(+1.f, tau.dxy());
223  mvaInput[7] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
224  mvaInput[8] = std::min(10.f, std::abs(tau.dxy_Sig()));
225  mvaInput[9] = ( tau.hasSecondaryVertex() ) ? 1. : 0.;
226  mvaInput[10] = std::sqrt(decayDistMag);
227  mvaInput[11] = std::min(10.f, tau.flightLengthSig());
228  } else if ( mvaOpt == kDBoldDMwLT || mvaOpt == kDBnewDMwLT ) {
229  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
230  mvaInput[1] = std::abs((float)tau.eta());
231  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
232  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
233  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
234  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
235  mvaInput[6] = tauDecayMode;
236  mvaInput[7] = std::min(30.f, nPhoton);
237  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
238  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
239  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
240  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
241  mvaInput[12] = std::min(100.f, leadingTrackChi2);
242  mvaInput[13] = std::min(1.f, eRatio);
243  mvaInput[14] = std::copysign(+1.f, tau.dxy());
244  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
245  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
246  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
247  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
248  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
249  mvaInput[20] = ( tau.hasSecondaryVertex() ) ? 1. : 0.;
250  mvaInput[21] = std::sqrt(decayDistMag);
251  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
252  } else if ( mvaOpt == kPWoldDMwLT || mvaOpt == kPWnewDMwLT ) {
253  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
254  mvaInput[1] = std::abs((float)tau.eta());
255  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
256  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
257  mvaInput[4] = std::log(std::max(1.e-2f, footprintCorrection));
258  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
259  mvaInput[6] = tauDecayMode;
260  mvaInput[7] = std::min(30.f, nPhoton);
261  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
262  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
263  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
264  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
265  mvaInput[12] = std::min(100.f, leadingTrackChi2);
266  mvaInput[13] = std::min(1.f, eRatio);
267  mvaInput[14] = std::copysign(+1.f, tau.dxy());
268  mvaInput[15] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
269  mvaInput[16] = std::min(10.f, std::abs(tau.dxy_Sig()));
270  mvaInput[17] = std::copysign(+1.f, tau.ip3d());
271  mvaInput[18] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
272  mvaInput[19] = std::min(10.f, std::abs(tau.ip3d_Sig()));
273  mvaInput[20] = ( tau.hasSecondaryVertex() ) ? 1. : 0.;
274  mvaInput[21] = std::sqrt(decayDistMag);
275  mvaInput[22] = std::min(10.f, tau.flightLengthSig());
276  } else if ( mvaOpt == kDBoldDMwLTwGJ || mvaOpt == kDBnewDMwLTwGJ ) {
277  mvaInput[0] = std::log(std::max(1.f, (float)tau.pt()));
278  mvaInput[1] = std::abs((float)tau.eta());
279  mvaInput[2] = std::log(std::max(1.e-2f, chargedIsoPtSum));
280  mvaInput[3] = std::log(std::max(1.e-2f, neutralIsoPtSum));
281  mvaInput[4] = std::log(std::max(1.e-2f, puCorrPtSum));
282  mvaInput[5] = std::log(std::max(1.e-2f, photonPtSumOutsideSignalCone));
283  mvaInput[6] = tauDecayMode;
284  mvaInput[7] = std::min(30.f, nPhoton);
285  mvaInput[8] = std::min(0.5f, ptWeightedDetaStrip);
286  mvaInput[9] = std::min(0.5f, ptWeightedDphiStrip);
287  mvaInput[10] = std::min(0.5f, ptWeightedDrSignal);
288  mvaInput[11] = std::min(0.5f, ptWeightedDrIsolation);
289  mvaInput[12] = std::min(1.f, eRatio);
290  mvaInput[13] = std::copysign(+1.f, tau.dxy());
291  mvaInput[14] = std::sqrt(std::min(1.f, std::abs(tau.dxy())));
292  mvaInput[15] = std::min(10.f, std::abs(tau.dxy_Sig()));
293  mvaInput[16] = std::copysign(+1.f, tau.ip3d());
294  mvaInput[17] = std::sqrt(std::min(1.f, std::abs(tau.ip3d())));
295  mvaInput[18] = std::min(10.f, std::abs(tau.ip3d_Sig()));
296  mvaInput[19] = ( tau.hasSecondaryVertex() ) ? 1. : 0.;
297  mvaInput[20] = std::sqrt(decayDistMag);
298  mvaInput[21] = std::min(10.f, tau.flightLengthSig());
299  mvaInput[22] = std::max(-1.f, gjAngleDiff);
300  }
301 
302  return true;
303  }
304  return false;
305  }
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 ...
double eta() const final
momentum pseudorapidity
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
float dxy() const
Definition: Tau.h:314
double pt() const final
transverse momentum
float ip3d_Sig() const
float tauID(const std::string &name) const
float ip3d() const
Definition: Tau.h:327
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
T sqrt(T t)
Definition: SSEVec.h:18
const pat::tau::TauPFEssential::Vector & flightLength() const
Definition: Tau.h:321
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]
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
bool hasSecondaryVertex() const
Definition: Tau.h:320
T min(T a, T b)
Definition: MathUtil.h:58
double p() const final
magnitude of momentum vector
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
int decayMode() const
reconstructed tau decay mode (specific to PFTau)
Definition: Tau.h:365
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
float flightLengthSig() const
Definition: Tau.h:322
float dxy_Sig() const
float leadingTrackNormChi2() const
return normalized chi2 of leading track
Definition: Tau.h:338
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
template<typename Iterator >
std::vector<PFCandidatePtr> reco::tau::filterPFCandidates ( const Iterator begin,
const Iterator end,
int  particleId,
bool  sort = true 
)

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

Definition at line 39 of file RecoTauCommonUtilities.h.

References end, flattenPiZeros(), metsig::jet, convertSQLitetoXML_cfg::output, pfCandidates(), pfChargedCands(), and pfGammas().

Referenced by pfCandidates(), and pfChargedCands().

40  {
41  std::vector<PFCandidatePtr> output;
42  for(Iterator iter = begin; iter != end; ++iter) {
43  reco::PFCandidatePtr ptr(*iter);
44  if (ptr->particleId() == particleId)
45  output.push_back(ptr);
46  }
47  if (sort) std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
48  return output;
49 }
#define end
Definition: vmac.h:39
std::vector< PFCandidatePtr > 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 16 of file RecoTauCommonUtilities.cc.

References convertSQLitetoXML_cfg::output.

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

16  {
17  std::vector<PFCandidatePtr> output;
18 
19  for(std::vector<RecoTauPiZero>::const_iterator piZero = piZerosBegin;
20  piZero != piZerosEnd; ++piZero) {
21  for(size_t iDaughter = 0; iDaughter < piZero->numberOfDaughters();
22  ++iDaughter) {
23  output.push_back(PFCandidatePtr(piZero->daughterPtr(iDaughter)));
24  }
25  }
26  return output;
27 }
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
std::vector< PFCandidatePtr > reco::tau::flattenPiZeros ( const std::vector< RecoTauPiZero > &  piZeros)

Definition at line 30 of file RecoTauCommonUtilities.cc.

References flattenPiZeros().

30  {
31  return flattenPiZeros(piZeros.begin(), piZeros.end());
32 }
std::vector< PFCandidatePtr > 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.
PFTau::hadronicDecayMode reco::tau::getDecayMode ( const reco::GenJet genJet)

Definition at line 80 of file PFTauDecayModeTools.cc.

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

Referenced by tautools::RecoTauDecayModeTruthMatchPlugin::operator()().

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

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

Definition at line 45 of file PFRecoTauClusterVariables.cc.

References objects.autophobj::float, edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), and reco::PFTau::leadPFChargedHadrCand().

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

45  {
46  float LeadingTracknormalizedChi2 = 0;
47  const reco::PFCandidatePtr& leadingPFCharged = tau.leadPFChargedHadrCand() ;
48  if (leadingPFCharged.isNonnull()) {
49  reco::TrackRef tref = leadingPFCharged -> trackRef();
50  if (tref.isNonnull()) {
51  LeadingTracknormalizedChi2 = (float)(tref -> normalizedChi2());
52  }
53  }
54  return LeadingTracknormalizedChi2;
55  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
template<typename InputIterator >
InputIterator reco::tau::leadPFCand ( InputIterator  begin,
InputIterator  end 
)

Definition at line 131 of file RecoTauCommonUtilities.h.

References begin, and end.

Referenced by reco::tau::RecoTauConstructor::get(), reco::tau::RecoTauVertexAssociator::getLeadTrack(), pat::Tau::leadPFChargedHadrCandsignedSipt(), reco::tau::RecoTauBuilderConePlugin::operator()(), reco::operator<<(), and reco::PFTau::~PFTau().

132  {
133  double max_pt = 0;
134  InputIterator max_cand = begin;
135  for(InputIterator cand = begin; cand != end; ++cand) {
136  if( (*cand)->pt() > max_pt ) {
137  max_pt = (*cand)->pt();
138  max_cand = cand;
139  }
140  }
141  return max_cand;
142  }
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
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 133 of file PFRecoTauClusterVariables.cc.

References reco::PFTau::isolationPFGammaCands(), and reco::PFTau::signalPFGammaCands().

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

133  {
134  unsigned int n_photons = 0;
135  for (auto& cand : tau.signalPFGammaCands()) {
136  if (cand->pt() > 0.5)
137  ++n_photons;
138  }
139  for (auto& cand : tau.isolationPFGammaCands()) {
140  if (cand->pt() > 0.5)
141  ++n_photons;
142  }
143  return n_photons;
144  }
const std::vector< reco::PFCandidatePtr > & signalPFGammaCands() const
Gamma candidates in signal region.
Definition: PFTau.cc:84
const std::vector< reco::PFCandidatePtr > & isolationPFGammaCands() const
Gamma candidates in isolation region.
Definition: PFTau.cc:93
unsigned int reco::tau::n_photons_total ( const pat::Tau tau)

Definition at line 145 of file PFRecoTauClusterVariables.cc.

References pat::Tau::isolationGammaCands(), and pat::Tau::signalGammaCands().

145  {
146  unsigned int n_photons = 0;
147  for (auto& cand : tau.signalGammaCands()) {
148  if (cand->pt() > 0.5)
149  ++n_photons;
150  }
151  for (auto& cand : tau.isolationGammaCands()) {
152  if (cand->pt() > 0.5)
153  ++n_photons;
154  }
155  return n_photons;
156  }
reco::CandidatePtrVector signalGammaCands() const
reco::CandidatePtrVector isolationGammaCands() const
std::vector< reco::PFCandidatePtr > reco::tau::pfCandidates ( const PFJet 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

Definition at line 34 of file RecoTauCommonUtilities.cc.

References filterPFCandidates(), and reco::PFJet::getPFConstituents().

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

35  {
36  PFCandPtrs pfCands = jet.getPFConstituents();
37  PFCandPtrs selectedPFCands = filterPFCandidates(
38  pfCands.begin(), pfCands.end(), particleId, sort);
39  return selectedPFCands;
40 }
std::vector< reco::PFCandidatePtr > PFCandPtrs
std::vector< PFCandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int particleId, bool sort=true)
std::vector< reco::PFCandidatePtr > reco::tau::pfCandidates ( const PFJet 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 42 of file RecoTauCommonUtilities.cc.

References filterPFCandidates(), reco::PFJet::getPFConstituents(), and convertSQLitetoXML_cfg::output.

43  {
44  PFCandPtrs&& pfCands = jet.getPFConstituents();
46  // Get each desired candidate type, unsorted for now
47  for(std::vector<int>::const_iterator particleId = particleIds.begin();
48  particleId != particleIds.end(); ++particleId) {
49  PFCandPtrs&& selectedPFCands = filterPFCandidates(pfCands.begin(), pfCands.end(), *particleId, false);
50  output.insert(output.end(), selectedPFCands.begin(), selectedPFCands.end());
51  }
52  if (sort) std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
53  return output;
54 }
std::vector< reco::PFCandidatePtr > PFCandPtrs
std::vector< PFCandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int particleId, bool sort=true)
std::vector< reco::PFCandidatePtr > reco::tau::pfChargedCands ( const PFJet jet,
bool  sort = true 
)

Extract all non-neutral candidates from a PFJet.

Definition at line 60 of file RecoTauCommonUtilities.cc.

References reco::PFCandidate::e, filterPFCandidates(), reco::PFJet::getPFConstituents(), reco::PFCandidate::h, reco::PFCandidate::mu, and convertSQLitetoXML_cfg::output.

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

61  {
62  PFCandPtrs&& pfCands = jet.getPFConstituents();
64  PFCandPtrs&& mus = filterPFCandidates(pfCands.begin(), pfCands.end(), reco::PFCandidate::mu, false);
65  PFCandPtrs&& es = filterPFCandidates(pfCands.begin(), pfCands.end(), reco::PFCandidate::e, false);
66  PFCandPtrs&& chs = filterPFCandidates(pfCands.begin(), pfCands.end(), reco::PFCandidate::h, false);
67  output.reserve(mus.size() + es.size() + chs.size());
68  output.insert(output.end(), mus.begin(), mus.end());
69  output.insert(output.end(), es.begin(), es.end());
70  output.insert(output.end(), chs.begin(), chs.end());
71  if (sort) std::sort(output.begin(), output.end(), SortPFCandsDescendingPt());
72  return output;
73 }
std::vector< reco::PFCandidatePtr > PFCandPtrs
std::vector< PFCandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int particleId, bool sort=true)
std::vector< reco::PFCandidatePtr > reco::tau::pfGammas ( const PFJet jet,
bool  sort = true 
)
unsigned int reco::tau::piZerosInDecayMode ( PFTau::hadronicDecayMode  mode)

Definition at line 50 of file PFTauDecayModeTools.cc.

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

50  {
51  int modeAsInt = static_cast<int>(mode);
52  return (modeAsInt % PFTau::kOneProngNPiZero);
53 }
reco::PFTau::hadronicDecayMode mode
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 39 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

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

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)
float reco::tau::pt_weighted_deta_strip ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 42 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

42  {
43  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 1, dm);
44  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
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 47 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

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

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)
float reco::tau::pt_weighted_dphi_strip ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 50 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

50  {
51  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 2, dm);
52  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
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 55 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

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

55  {
56  return pt_weighted_dx(tau, 2, 0, dm);
57  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
float reco::tau::pt_weighted_dr_iso ( const pat::Tau tau,
int  dm 
)
inline

Definition at line 58 of file PFRecoTauClusterVariables.h.

References n_photons_total(), pt_weighted_dx(), and metsig::tau.

58  {
59  return pt_weighted_dx(tau, 2, 0, dm);
60  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
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 31 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

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

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

Definition at line 34 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

34  {
35  return pt_weighted_dx(tau, 0, 0, dm);
36  }
float pt_weighted_dx(const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1)
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 126 of file PFRecoTauClusterVariables.cc.

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

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

float reco::tau::pt_weighted_dx ( const pat::Tau tau,
int  mode = 0,
int  var = 0,
int  decaymode = -1 
)
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 82 of file PFRecoTauClusterVariables.cc.

References funct::abs(), egammaForCoreTracking_cff::cands, reco::deltaPhi(), reco::deltaR(), runTauDisplay::dr, RemoveAddSevLevel::flag, SiStripPI::max, min(), EnergyCorrector::pt, and metsig::tau.

82  {
83  float sum_pt = 0.;
84  float sum_dx_pt = 0.;
85  float signalrad = std::max(0.05, std::min(0.1, 3./std::max(1., tau.pt())));
86  int is3prong = (decaymode==10);
87  const auto& cands = getGammas_T<T>(tau, mode < 2);
88  for (const auto& cand : cands) {
89  // only look at electrons/photons with pT > 0.5
90  if (cand->pt() < 0.5){
91  continue;
92  }
93  float dr = reco::deltaR(cand->eta(), cand->phi(), tau.eta(), tau.phi());
94  float deta = std::abs(cand->eta() - tau.eta());
95  float dphi = std::abs(reco::deltaPhi(cand->phi(), tau.phi()));
96  float pt = cand->pt();
97  bool flag = isInside(pt, deta, dphi);
98  if(is3prong==0){
99  if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
100  sum_pt += pt;
101  if (var == 0)
102  sum_dx_pt += pt * dr;
103  else if (var == 1)
104  sum_dx_pt += pt * deta;
105  else if (var == 2)
106  sum_dx_pt += pt * dphi;
107  }
108  }
109  else if(is3prong==1){
110  if( (mode==2 && flag==false) || (mode==1 && flag==true) || mode==0){
111  sum_pt += pt;
112  if (var == 0)
113  sum_dx_pt += pt * dr;
114  else if (var == 1)
115  sum_dx_pt += pt * deta;
116  else if (var == 2)
117  sum_dx_pt += pt * dphi;
118  }
119  }
120  }
121  if (sum_pt > 0.){
122  return sum_dx_pt/sum_pt;
123  }
124  return 0.;
125  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< PATTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_filler__LINE__ ( "PATTauDiscriminationByMVAIsolationRun2"  )
static
static const edm::ParameterSetDescriptionFillerPluginFactory::PMaker<edm::ParameterSetDescriptionFiller< PFRecoTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_filler__LINE__ ( "PFRecoTauDiscriminationByMVAIsolationRun2"  )
static
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PATTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_maker__LINE__ ( "PATTauDiscriminationByMVAIsolationRun2"  )
static
static const edm::MakerPluginFactory ::PMaker< edm::WorkerMaker< PFRecoTauDiscriminationByMVAIsolationRun2 > > reco::tau::s_maker__LINE__ ( "PFRecoTauDiscriminationByMVAIsolationRun2"  )
static
void reco::tau::setChargedHadronP4 ( reco::PFRecoTauChargedHadron chargedHadron,
double  scaleFactor_neutralPFCands = 1.0 
)

Definition at line 10 of file pfRecoTauChargedHadronAuxFunctions.cc.

References reco::PFRecoTauChargedHadron::algoIs(), compChargedHadronP4fromPxPyPz(), reco::PFRecoTauChargedHadron::getChargedPFCandidate(), reco::PFRecoTauChargedHadron::getNeutralPFCandidates(), reco::PFRecoTauChargedHadron::getTrack(), edm::Ptr< T >::isNonnull(), reco::PFRecoTauChargedHadron::kChargedPFCandidate, reco::PFRecoTauChargedHadron::kPFNeutralHadron, reco::PFRecoTauChargedHadron::kTrack, electrons_cff::ptRatio, reco::LeafCandidate::setP4(), and HiIsolationCommonParameters_cff::track.

Referenced by reco::tau::RecoTauConstructor::addTauChargedHadron(), reco::tau::PFRecoTauEnergyAlgorithmPlugin::operator()(), reco::tau::PFRecoTauChargedHadronFromPFCandidatePlugin::operator()(), reco::tau::PFRecoTauChargedHadronFromTrackPlugin::operator()(), and PFRecoTauChargedHadronProducer::produce().

11 {
12  double chargedHadronP = 0.;
13  double chargedHadronPx = 0.;
14  double chargedHadronPy = 0.;
15  double chargedHadronPz = 0.;
16  double SumNeutrals = 0.;
19  const reco::PFCandidatePtr& chargedPFCand = chargedHadron.getChargedPFCandidate();
20  assert(chargedPFCand.isNonnull());
21  chargedHadronP += chargedPFCand->p();
22  chargedHadronPx = chargedPFCand->px();
23  chargedHadronPy = chargedPFCand->py();
24  chargedHadronPz = chargedPFCand->pz();
25  } else if ( chargedHadron.algoIs(reco::PFRecoTauChargedHadron::kTrack) ) {
26  const reco::PFRecoTauChargedHadron::TrackPtr& track = chargedHadron.getTrack();
27  assert(track.isNonnull());
28  chargedHadronP += track->p();
29  chargedHadronPx = track->px();
30  chargedHadronPy = track->py();
31  chargedHadronPz = track->pz();
32  } else assert(0);
33  const std::vector<reco::PFCandidatePtr>& neutralPFCands = chargedHadron.getNeutralPFCandidates();
34  for ( std::vector<reco::PFCandidatePtr>::const_iterator neutralPFCand = neutralPFCands.begin();
35  neutralPFCand != neutralPFCands.end(); ++neutralPFCand ) {
36  SumNeutrals += (*neutralPFCand)->p();
37  }
38  double noNeutrals=chargedHadronP;
39  chargedHadronP+=scaleFactor_neutralPFCands*SumNeutrals;
40  double ptRatio=chargedHadronP/noNeutrals;
41  chargedHadronPx*=ptRatio;
42  chargedHadronPy*=ptRatio;
43  chargedHadronPz*=ptRatio;
44 
45 
46  reco::Candidate::LorentzVector chargedHadronP4 = compChargedHadronP4fromPxPyPz(chargedHadronPx, chargedHadronPy, chargedHadronPz);
47  chargedHadron.setP4(chargedHadronP4);
48 }
const TrackPtr & getTrack() const
reference to reco::Track
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
const std::vector< PFCandidatePtr > & getNeutralPFCandidates() const
references to additional neutral PFCandidates
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const
Check whether a given algo produced this charged hadron.
void setP4(const LorentzVector &p4) final
set 4-momentum
const PFCandidatePtr & getChargedPFCandidate() const
reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) ...
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)
template<typename InputIterator >
int reco::tau::sumPFCandCharge ( InputIterator  begin,
InputIterator  end 
)

Sum the charge of a collection of PFCandidates.

Definition at line 126 of file RecoTauCommonUtilities.h.

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

127  {
129  }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
template<typename InputIterator >
reco::Candidate::LorentzVector reco::tau::sumPFCandP4 ( InputIterator  begin,
InputIterator  end 
)

Definition at line 113 of file RecoTauCommonUtilities.h.

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

114  {
117 }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.
double p4[4]
Definition: TauolaWrapper.h:92
#define end
Definition: vmac.h:39
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
#define begin
Definition: vmac.h:32
template<typename InputIterator >
double reco::tau::sumPFCandPt ( InputIterator  begin,
InputIterator  end 
)

Sum the pT of a collection of PFCandidates.

Definition at line 120 of file RecoTauCommonUtilities.h.

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

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

121  {
122  return sumPFVector(begin, end, &PFCandidate::pt, 0.0);
123  }
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
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 103 of file RecoTauCommonUtilities.h.

References end, patCandidates_cff::func, init, and convertSQLitetoXML_cfg::output.

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

104  {
106  for(InputIterator cand = begin; cand != end; ++cand) {
107  //#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
108  output += ((**cand).*(func))();
109  }
110  return output;
111  }
int init
Definition: HydjetWrapper.h:67
std::map< DetId, double > ReturnType
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
template<typename InputIterator >
InputIterator reco::tau::takeNElements ( const InputIterator &  begin,
const InputIterator &  end,
size_t  N 
)

Definition at line 95 of file RecoTauCommonUtilities.h.

References begin, and N.

Referenced by reco::tau::RecoTauPiZeroCombinatoricPlugin::operator()(), reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), reco::tau::RecoTauPiZeroStripPlugin::operator()(), reco::tau::RecoTauPiZeroStripPlugin2::operator()(), and reco::tau::RecoTauPiZeroStripPlugin3::operator()().

96  {
97  size_t input_size = end - begin;
98  return (N > input_size) ? end : begin + N;
99 }
#define end
Definition: vmac.h:39
#define N
Definition: blowfish.cc:9
#define begin
Definition: vmac.h:32
PFTau::hadronicDecayMode reco::tau::translateDecayMode ( unsigned int  nCharged,
unsigned int  nPiZero 
)

Definition at line 55 of file PFTauDecayModeTools.cc.

References reco::PFTau::kNull, reco::PFTau::kOneProngNPiZero, reco::PFTau::kRareDecayMode, RecoTauCombinatoricProducer_cfi::maxPiZeros, and hpstanc_transforms::nPiZeros.

Referenced by reco::tau::RecoTauObjectEmbedder< T >::operator()(), reco::tau::RecoTauDiscriminantInvariantWidth::RecoTauDiscriminantInvariantWidth(), and RecoTauMVATransform::RecoTauMVATransform().

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

Referenced by getDecayMode().

71  {
72  return decayModeStringToId(name.c_str(), dmTranslatorMap);
73 }
std::string reco::tau::translateRecoDecayModeToGen ( PFTau::hadronicDecayMode  decayMode)

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

Definition at line 75 of file PFTauDecayModeTools.cc.

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