CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
TauIdMVAAuxiliaries Class Reference

#include <PFRecoTauClusterVariables.h>

Public Member Functions

float pt_weighted_dx (const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
 
float pt_weighted_dx (const pat::Tau &tau, int mode=0, int var=0, int decaymode=-1) const
 
float tau_Eratio (const reco::PFTau &tau) const
 return ratio of energy in ECAL over sum of energy in ECAL and HCAL More...
 
float tau_Eratio (const pat::Tau &tau) const
 
float tau_leadTrackChi2 (const reco::PFTau &tau) const
 return chi2 of the leading track ==> deprecated? <== More...
 
unsigned int tau_n_photons_total (const reco::PFTau &tau) const
 return total number of pf photon candidates with pT>500 MeV, which are associated to signal More...
 
unsigned int tau_n_photons_total (const pat::Tau &tau) const
 
float tau_pt_weighted_deta_strip (const reco::PFTau &tau, int dm) const
 
float tau_pt_weighted_deta_strip (const pat::Tau &tau, int dm) const
 
float tau_pt_weighted_dphi_strip (const reco::PFTau &tau, int dm) const
 
float tau_pt_weighted_dphi_strip (const pat::Tau &tau, int dm) const
 
float tau_pt_weighted_dr_iso (const reco::PFTau &tau, int dm) const
 
float tau_pt_weighted_dr_iso (const pat::Tau &tau, int dm) const
 
float tau_pt_weighted_dr_signal (const reco::PFTau &tau, int dm) const
 
float tau_pt_weighted_dr_signal (const pat::Tau &tau, int dm) const
 
 TauIdMVAAuxiliaries ()
 default constructor More...
 
 ~TauIdMVAAuxiliaries ()
 default destructor More...
 

Private Member Functions

reco::CandidatePtrVector getGammas (const pat::Tau &tau, bool signal=true) const
 
const std::vector< reco::PFCandidatePtr > & getPFGammas (const reco::PFTau &tau, bool signal=true) const
 return pf photon candidates that are associated to signal More...
 
bool isInside (float photon_pt, float deta, float dphi) const
 decide if photon candidate is inside the cone to be associated to the tau signal More...
 

Detailed Description

Definition at line 16 of file PFRecoTauClusterVariables.h.

Constructor & Destructor Documentation

TauIdMVAAuxiliaries::TauIdMVAAuxiliaries ( )
inline

default constructor

Definition at line 19 of file PFRecoTauClusterVariables.h.

19 {};
TauIdMVAAuxiliaries::~TauIdMVAAuxiliaries ( )
inline

default destructor

Definition at line 21 of file PFRecoTauClusterVariables.h.

21 {};

Member Function Documentation

reco::CandidatePtrVector TauIdMVAAuxiliaries::getGammas ( const pat::Tau tau,
bool  signal = true 
) const
inlineprivate

Definition at line 216 of file PFRecoTauClusterVariables.h.

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

Referenced by pt_weighted_dx().

216  {
217  if(signal){
218  return tau.signalGammaCands();
219  }
220  return tau.isolationGammaCands();
221  }
reco::CandidatePtrVector signalGammaCands() const
reco::CandidatePtrVector isolationGammaCands() const
const std::vector<reco::PFCandidatePtr>& TauIdMVAAuxiliaries::getPFGammas ( const reco::PFTau tau,
bool  signal = true 
) const
inlineprivate

return pf photon candidates that are associated to signal

Definition at line 210 of file PFRecoTauClusterVariables.h.

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

Referenced by pt_weighted_dx().

210  {
211  if (signal){
212  return tau.signalPFGammaCands();
213  }
214  return tau.isolationPFGammaCands();
215  }
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
bool TauIdMVAAuxiliaries::isInside ( float  photon_pt,
float  deta,
float  dphi 
) const
inlineprivate

decide if photon candidate is inside the cone to be associated to the tau signal

Definition at line 223 of file PFRecoTauClusterVariables.h.

References SiStripPI::max, and funct::pow().

Referenced by pt_weighted_dx().

223  {
224  const double stripEtaAssociationDistance_0p95_p0 = 0.197077;
225  const double stripEtaAssociationDistance_0p95_p1 = 0.658701;
226  const double stripPhiAssociationDistance_0p95_p0 = 0.352476;
227  const double stripPhiAssociationDistance_0p95_p1 = 0.707716;
228  if(photon_pt==0){
229  return false;
230  }
231  if((dphi<0.3 && dphi<std::max(0.05, stripPhiAssociationDistance_0p95_p0*std::pow(photon_pt, -stripPhiAssociationDistance_0p95_p1))) && \
232  (deta<0.15 && deta<std::max(0.05, stripEtaAssociationDistance_0p95_p0*std::pow(photon_pt, -stripEtaAssociationDistance_0p95_p1)))){
233  return true;
234  }
235  return false;
236  }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
float TauIdMVAAuxiliaries::pt_weighted_dx ( const reco::PFTau tau,
int  mode = 0,
int  var = 0,
int  decaymode = -1 
) const
inline

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 62 of file PFRecoTauClusterVariables.h.

References funct::abs(), egammaForCoreTracking_cff::cands, runTauDisplay::decaymode, reco::deltaPhi(), reco::deltaR(), runTauDisplay::dr, reco::LeafCandidate::eta(), RemoveAddSevLevel::flag, objects.autophobj::float, getPFGammas(), isInside(), SiStripPI::max, min(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, reco::LeafCandidate::phi(), EnergyCorrector::pt, reco::LeafCandidate::pt(), and JetChargeProducer_cfi::var.

Referenced by tau_pt_weighted_deta_strip(), tau_pt_weighted_dphi_strip(), tau_pt_weighted_dr_iso(), and tau_pt_weighted_dr_signal().

62  {
63  float sum_pt = 0.;
64  float sum_dx_pt = 0.;
65  float signalrad = std::max(0.05, std::min(0.1, 3./std::max(1., tau.pt())));
66  int is3prong = (decaymode==10);
67  const auto& cands = getPFGammas(tau, mode < 2);
68  for (const auto& cand : cands) {
69  // only look at electrons/photons with pT > 0.5
70  if ((float)cand->pt() < 0.5){
71  continue;
72  }
73  float dr = reco::deltaR((float)cand->eta(),(float)cand->phi(),(float)tau.eta(),(float)tau.phi());
74  float deta = std::abs((float)cand->eta() - (float)tau.eta());
75  float dphi = std::abs(reco::deltaPhi((float)cand->phi(), (float)tau.phi()));
76  float pt = cand->pt();
77  bool flag = isInside(pt, deta, dphi);
78  if(is3prong==0){
79  if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
80  sum_pt += pt;
81  if (var == 0)
82  sum_dx_pt += pt * dr;
83  else if (var == 1)
84  sum_dx_pt += pt * deta;
85  else if (var == 2)
86  sum_dx_pt += pt * dphi;
87  }
88  }
89  else if(is3prong==1){
90  if( (mode==2 && flag==false) || (mode==1 && flag==true) || mode==0){
91  sum_pt += pt;
92  if (var == 0)
93  sum_dx_pt += pt * dr;
94  else if (var == 1)
95  sum_dx_pt += pt * deta;
96  else if (var == 2)
97  sum_dx_pt += pt * dphi;
98  }
99  }
100  }
101  if (sum_pt > 0.){
102  return sum_dx_pt/sum_pt;
103  }
104  return 0.;
105  }
double eta() const final
momentum pseudorapidity
const std::vector< reco::PFCandidatePtr > & getPFGammas(const reco::PFTau &tau, bool signal=true) const
return pf photon candidates that are associated to signal
double pt() const final
transverse momentum
bool isInside(float photon_pt, float deta, float dphi) const
decide if photon candidate is inside the cone to be associated to the tau signal
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
T min(T a, T b)
Definition: MathUtil.h:58
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
double phi() const final
momentum azimuthal angle
float TauIdMVAAuxiliaries::pt_weighted_dx ( const pat::Tau tau,
int  mode = 0,
int  var = 0,
int  decaymode = -1 
) const
inline

Definition at line 106 of file PFRecoTauClusterVariables.h.

References funct::abs(), egammaForCoreTracking_cff::cands, runTauDisplay::decaymode, reco::deltaPhi(), reco::deltaR(), runTauDisplay::dr, reco::LeafCandidate::eta(), RemoveAddSevLevel::flag, getGammas(), isInside(), SiStripPI::max, min(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, reco::LeafCandidate::phi(), EnergyCorrector::pt, reco::LeafCandidate::pt(), and JetChargeProducer_cfi::var.

106  {
107  float sum_pt = 0.;
108  float sum_dx_pt = 0.;
109  float signalrad = std::max(0.05, std::min(0.1, 3./std::max(1., tau.pt())));
110  int is3prong = (decaymode==10);
111  const auto cands = getGammas(tau, mode < 2);
112  for (const auto& cand : cands) {
113  // only look at electrons/photons with pT > 0.5
114  if (cand->pt() < 0.5){
115  continue;
116  }
117  float dr = reco::deltaR(*cand, tau);
118  float deta = std::abs(cand->eta() - tau.eta());
119  float dphi = std::abs(reco::deltaPhi(cand->phi(), tau.phi()));
120  float pt = cand->pt();
121  bool flag = isInside(pt, deta, dphi);
122  if(is3prong==0){
123  if (mode == 2 || (mode == 0 && dr < signalrad) || (mode == 1 && dr > signalrad)) {
124  sum_pt += pt;
125  if (var == 0)
126  sum_dx_pt += pt * dr;
127  else if (var == 1)
128  sum_dx_pt += pt * deta;
129  else if (var == 2)
130  sum_dx_pt += pt * dphi;
131  }
132  }
133  else if(is3prong==1){
134  if( (mode==2 && flag==false) || (mode==1 && flag==true) || mode==0){
135  sum_pt += pt;
136  if (var == 0)
137  sum_dx_pt += pt * dr;
138  else if (var == 1)
139  sum_dx_pt += pt * deta;
140  else if (var == 2)
141  sum_dx_pt += pt * dphi;
142  }
143  }
144  }
145  if (sum_pt > 0.){
146  return sum_dx_pt/sum_pt;
147  }
148  return 0.;
149  }
double eta() const final
momentum pseudorapidity
reco::CandidatePtrVector getGammas(const pat::Tau &tau, bool signal=true) const
double pt() const final
transverse momentum
bool isInside(float photon_pt, float deta, float dphi) const
decide if photon candidate is inside the cone to be associated to the tau signal
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
T min(T a, T b)
Definition: MathUtil.h:58
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
double phi() const final
momentum azimuthal angle
float TauIdMVAAuxiliaries::tau_Eratio ( const reco::PFTau tau) const
inline

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

Definition at line 35 of file PFRecoTauClusterVariables.h.

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

35  {
36  std::vector<reco::PFCandidatePtr> constsignal = tau.signalPFCands();
37  float EcalEnInSignalPFCands = 0;
38  float HcalEnInSignalPFCands = 0;
39  typedef std::vector <reco::PFCandidatePtr>::iterator constituents_iterator;
40  for(constituents_iterator it=constsignal.begin(); it != constsignal.end(); ++it) {
41  reco::PFCandidatePtr & icand = *it;
42  EcalEnInSignalPFCands += icand -> ecalEnergy();
43  HcalEnInSignalPFCands += icand -> hcalEnergy();
44  }
45  float total = EcalEnInSignalPFCands + HcalEnInSignalPFCands;
46  if(total==0){
47  return -1;
48  }
49  return EcalEnInSignalPFCands/total;
50  }
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
float TauIdMVAAuxiliaries::tau_Eratio ( const pat::Tau tau) const
inline

Definition at line 51 of file PFRecoTauClusterVariables.h.

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

51  {
52  float EcalEnInSignalCands = tau.ecalEnergy();
53  float HcalEnInSignalCands = tau.hcalEnergy();
54  float total = EcalEnInSignalCands + HcalEnInSignalCands;
55  if(total == 0){
56  return -1;
57  }
58  return EcalEnInSignalCands/total;
59  }
float hcalEnergy() const
return sum of hcal energies from signal candidates
Definition: Tau.h:336
float ecalEnergy() const
Definition: Tau.h:334
float TauIdMVAAuxiliaries::tau_leadTrackChi2 ( const reco::PFTau tau) const
inline

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

Definition at line 23 of file PFRecoTauClusterVariables.h.

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

23  {
24  float LeadingTracknormalizedChi2 = 0;
25  const reco::PFCandidatePtr& leadingPFCharged = tau.leadPFChargedHadrCand() ;
26  if (leadingPFCharged.isNonnull()) {
27  reco::TrackRef tref = leadingPFCharged -> trackRef();
28  if (tref.isNonnull()) {
29  LeadingTracknormalizedChi2 = (float)(tref -> normalizedChi2());
30  }
31  }
32  return LeadingTracknormalizedChi2;
33  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
const PFCandidatePtr & leadPFChargedHadrCand() const
Definition: PFTau.cc:67
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
unsigned int TauIdMVAAuxiliaries::tau_n_photons_total ( const reco::PFTau tau) const
inline

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

Definition at line 183 of file PFRecoTauClusterVariables.h.

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

183  {
184  unsigned int n_photons = 0;
185  for (auto& cand : tau.signalPFGammaCands()) {
186  if ((float)cand->pt() > 0.5)
187  ++n_photons;
188  }
189  for (auto& cand : tau.isolationPFGammaCands()) {
190  if ((float)cand->pt() > 0.5)
191  ++n_photons;
192  }
193  return n_photons;
194  }
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 TauIdMVAAuxiliaries::tau_n_photons_total ( const pat::Tau tau) const
inline

Definition at line 195 of file PFRecoTauClusterVariables.h.

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

195  {
196  unsigned int n_photons = 0;
197  for (auto& cand : tau.signalGammaCands()) {
198  if (cand->pt() > 0.5)
199  ++n_photons;
200  }
201  for (auto& cand : tau.isolationGammaCands()) {
202  if (cand->pt() > 0.5)
203  ++n_photons;
204  }
205  return n_photons;
206  }
reco::CandidatePtrVector signalGammaCands() const
reco::CandidatePtrVector isolationGammaCands() const
float TauIdMVAAuxiliaries::tau_pt_weighted_deta_strip ( const reco::PFTau tau,
int  dm 
) const
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 160 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

160  {
161  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 1, dm);
162  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_deta_strip ( const pat::Tau tau,
int  dm 
) const
inline

Definition at line 163 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

163  {
164  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 1, dm);
165  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dphi_strip ( const reco::PFTau tau,
int  dm 
) const
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 168 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

168  {
169  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 2, dm);
170  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dphi_strip ( const pat::Tau tau,
int  dm 
) const
inline

Definition at line 171 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

171  {
172  return pt_weighted_dx(tau, dm==10 ? 2 : 1, 2, dm);
173  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dr_iso ( const reco::PFTau tau,
int  dm 
) const
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 176 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

176  {
177  return pt_weighted_dx(tau, 2, 0, dm);
178  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dr_iso ( const pat::Tau tau,
int  dm 
) const
inline

Definition at line 179 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

179  {
180  return pt_weighted_dx(tau, 2, 0, dm);
181  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dr_signal ( const reco::PFTau tau,
int  dm 
) const
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 152 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

152  {
153  return pt_weighted_dx(tau, 0, 0, dm);
154  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const
float TauIdMVAAuxiliaries::tau_pt_weighted_dr_signal ( const pat::Tau tau,
int  dm 
) const
inline

Definition at line 155 of file PFRecoTauClusterVariables.h.

References pt_weighted_dx().

155  {
156  return pt_weighted_dx(tau, 0, 0, dm);
157  }
float pt_weighted_dx(const reco::PFTau &tau, int mode=0, int var=0, int decaymode=-1) const