CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
reco::tau::RecoTauBuilderConePlugin Class Reference
Inheritance diagram for reco::tau::RecoTauBuilderConePlugin:
reco::tau::RecoTauBuilderPlugin reco::tau::RecoTauEventHolderPlugin reco::tau::RecoTauNamedPlugin

Public Member Functions

return_type operator() (const reco::JetBaseRef &jet, const std::vector< reco::PFRecoTauChargedHadron > &chargedHadrons, const std::vector< RecoTauPiZero > &piZeros, const std::vector< CandidatePtr > &regionalExtras) const override
 
 RecoTauBuilderConePlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~RecoTauBuilderConePlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauBuilderPlugin
void beginEvent () override
 
const edm::Handle< edm::View< reco::Candidate > > & getPFCands () const
 Hack to be able to convert Ptrs to Refs. More...
 
reco::VertexRef primaryVertex (const reco::JetBaseRef &jet) const
 Get primary vertex associated to this jet. More...
 
reco::VertexRef primaryVertex (const reco::PFTau &tau, bool useJet=false) const
 Get primary vertex associated to this tau. More...
 
 RecoTauBuilderPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~RecoTauBuilderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauEventHolderPlugin
const edm::Eventevt () const
 
edm::Eventevt ()
 
const edm::EventSetupevtSetup () const
 
 RecoTauEventHolderPlugin (const edm::ParameterSet &pset)
 
void setup (edm::Event &, const edm::EventSetup &)
 
 ~RecoTauEventHolderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauNamedPlugin
const std::string & name () const
 
 RecoTauNamedPlugin (const edm::ParameterSet &pset)
 
virtual ~RecoTauNamedPlugin ()
 

Private Types

typedef StringObjectFunction< reco::JetJetFunc
 

Private Member Functions

void setTauQuantities (reco::PFTau &aTau, double minAbsPhotonSumPt_insideSignalCone=2.5, double minRelPhotonSumPt_insideSignalCone=0., double minAbsPhotonSumPt_outsideSignalCone=1.e+9, double minRelPhotonSumPt_outsideSignalCone=1.e+9) const
 

Private Attributes

JetFunc isoConeChargedHadrons_
 
JetFunc isoConeNeutralHadrons_
 
JetFunc isoConePiZeros_
 
double leadObjecPtThreshold_
 
JetFunc matchingCone_
 
int maxSignalConeChargedHadrons_
 
double minAbsPhotonSumPt_insideSignalCone_
 
double minRelPhotonSumPt_insideSignalCone_
 
RecoTauQualityCuts qcuts_
 
JetFunc signalConeChargedHadrons_
 
JetFunc signalConeNeutralHadrons_
 
JetFunc signalConePiZeros_
 
StringObjectFunction< reco::PFTausignalConeSizeToStore_
 
bool usePFLeptonsAsChargedHadrons_
 

Additional Inherited Members

- Public Types inherited from reco::tau::RecoTauBuilderPlugin
typedef boost::ptr_vector< reco::PFTauoutput_type
 
typedef std::auto_ptr< output_typereturn_type
 

Detailed Description

Definition at line 34 of file RecoTauBuilderConePlugin.cc.

Member Typedef Documentation

Definition at line 51 of file RecoTauBuilderConePlugin.cc.

Constructor & Destructor Documentation

reco::tau::RecoTauBuilderConePlugin::RecoTauBuilderConePlugin ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 76 of file RecoTauBuilderConePlugin.cc.

79  "qualityCuts").getParameterSet("signalQualityCuts")),
80  usePFLeptonsAsChargedHadrons_(pset.getParameter<bool>("usePFLeptons")),
81  leadObjecPtThreshold_(pset.getParameter<double>("leadObjectPt")),
82  matchingCone_(pset.getParameter<std::string>("matchingCone")),
84  "signalConeChargedHadrons")),
86  pset.getParameter<std::string>("isoConeChargedHadrons")),
88  pset.getParameter<std::string>("signalConePiZeros")),
89  signalConeSizeToStore_(//MB: stored inside PFTau and used to compte photon-pt-out-of-signal-cone and DM hypothsis
90  pset.getParameter<std::string>("signalConePiZeros")),
92  pset.getParameter<std::string>("isoConePiZeros")),
94  pset.getParameter<std::string>("signalConeNeutralHadrons")),
96  pset.getParameter<std::string>("isoConeNeutralHadrons")),
98  pset.getParameter<int>("maxSignalConeChargedHadrons")),
100  pset.getParameter<double>("minAbsPhotonSumPt_insideSignalCone")),
102  pset.getParameter<double>("minRelPhotonSumPt_insideSignalCone"))
103 
104 {}
T getParameter(std::string const &) const
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
ParameterSet const & getParameterSet(std::string const &) const
RecoTauBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
def move(src, dest)
Definition: eostools.py:511
reco::tau::RecoTauBuilderConePlugin::~RecoTauBuilderConePlugin ( )
inlineoverride

Definition at line 37 of file RecoTauBuilderConePlugin.cc.

References metsig::jet, and operator()().

37 {}

Member Function Documentation

RecoTauBuilderConePlugin::return_type reco::tau::RecoTauBuilderConePlugin::operator() ( const reco::JetBaseRef ,
const std::vector< reco::PFRecoTauChargedHadron > &  ,
const std::vector< RecoTauPiZero > &  ,
const std::vector< CandidatePtr > &   
) const
overridevirtual

Construct one or more PFTaus from the a PFJet and its asscociated reconstructed PiZeros and regional extras i.e. objects in a 0.8 cone about the jet

Implements reco::tau::RecoTauBuilderPlugin.

Definition at line 187 of file RecoTauBuilderConePlugin.cc.

References reco::tau::RecoTauConstructor::addPFCands(), reco::tau::RecoTauConstructor::addPiZeros(), DEFINE_EDM_PLUGIN, reco::tau::RecoTauQualityCuts::filterCandRefs(), reco::tau::RecoTauConstructor::get(), reco::tau::RecoTauBuilderPlugin::getPFCands(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), isoConeChargedHadrons_, isoConeNeutralHadrons_, isoConePiZeros_, reco::tau::RecoTauConstructor::kChargedHadron, reco::tau::RecoTauConstructor::kGamma, reco::tau::RecoTauConstructor::kIsolation, reco::tau::RecoTauConstructor::kNeutralHadron, reco::tau::RecoTauConstructor::kSignal, leadObjecPtThreshold_, reco::tau::xclean::makePredicateAND(), HPSPFRecoTauProducer_cfi::matchingCone, matchingCone_, maxSignalConeChargedHadrons_, minAbsPhotonSumPt_insideSignalCone_, minRelPhotonSumPt_insideSignalCone_, convertSQLitetoXML_cfg::output, reco::tau::pfCandidatesByPdgId(), reco::tau::pfChargedCands(), reco::tau::pfGammas(), reco::tau::RecoTauBuilderPlugin::primaryVertex(), qcuts_, reco::tau::RecoTauConstructor::setleadCand(), reco::tau::RecoTauConstructor::setleadChargedHadrCand(), reco::tau::RecoTauConstructor::setleadNeutralCand(), reco::tau::RecoTauQualityCuts::setPV(), setTauQuantities(), signalConeChargedHadrons_, signalConeNeutralHadrons_, signalConePiZeros_, signalConeSizeToStore_, metsig::tau, and usePFLeptonsAsChargedHadrons_.

Referenced by ~RecoTauBuilderConePlugin().

191  {
192  //std::cout << "<RecoTauBuilderConePlugin::operator()>:" << std::endl;
193  //std::cout << " jet: Pt = " << jet->pt() << ", eta = " << jet->eta() << ", phi = " << jet->phi() << std::endl;
194 
195  // Get access to our cone tools
196  using namespace cone;
197  // Define output. We only produce one tau per jet for the cone algo.
199 
200  // Our tau builder - the true indicates to automatically copy gamma candidates
201  // from the pizeros.
202  RecoTauConstructor tau(jet, getPFCands(), true,
206  // Setup our quality cuts to use the current vertex (supplied by base class)
208 
209  typedef std::vector<CandidatePtr> CandPtrs;
210 
211  // Get the PF Charged hadrons + quality cuts
212  CandPtrs pfchs;
215  } else {
216  // Check if we want to include electrons in muons in "charged hadron"
217  // collection. This is the preferred behavior, as the PF lepton selections
218  // are very loose.
220  }
221 
222  // CV: sort collection of PF Charged hadrons by descending Pt
223  std::sort(pfchs.begin(), pfchs.end(), SortPFCandsDescendingPt());
224 
225  // Get the PF gammas
226  CandPtrs pfGammas = qcuts_.filterCandRefs(
227  pfCandidatesByPdgId(*jet, 22));
228  // Neutral hadrons
229  CandPtrs pfnhs = qcuts_.filterCandRefs(
230  pfCandidatesByPdgId(*jet, 130));
231 
232  // All the extra junk
233  CandPtrs regionalJunk = qcuts_.filterCandRefs(regionalExtras);
234 
235  /***********************************************
236  ****** Lead Candidate Finding **********
237  ***********************************************/
238 
239  // Define our matching cone and filters
240  double matchingCone = matchingCone_(*jet);
241  CandPtrDRFilter matchingConeFilter(jet->p4(), 0, matchingCone);
242 
243  // Find the maximum PFCharged hadron in the matching cone. The call to
244  // PFCandidates always a sorted list, so we can just take the first if it
245  // if it exists.
246  CandidatePtr leadPFCH;
247  CandPtrs::iterator leadPFCH_iter =
248  std::find_if(pfchs.begin(), pfchs.end(), matchingConeFilter);
249 
250  if (leadPFCH_iter != pfchs.end()) {
251  leadPFCH = *leadPFCH_iter;
252  // Set leading candidate
253  tau.setleadChargedHadrCand(leadPFCH);
254  } else {
255  // If there is no leading charged candidate at all, return nothing - the
256  // producer class that owns the plugin will build a null tau if desired.
257  return output.release();
258  }
259 
260  // Find the leading neutral candidate
261  CandidatePtr leadPFGamma;
262  CandPtrs::iterator leadPFGamma_iter =
263  std::find_if(pfGammas.begin(), pfGammas.end(), matchingConeFilter);
264 
265  if (leadPFGamma_iter != pfGammas.end()) {
266  leadPFGamma = *leadPFGamma_iter;
267  // Set leading neutral candidate
268  tau.setleadNeutralCand(leadPFGamma);
269  }
270 
271  CandidatePtr leadPFCand;
272  // Always use the leadPFCH if it is above our threshold
273  if (leadPFCH.isNonnull() && leadPFCH->pt() > leadObjecPtThreshold_) {
274  leadPFCand = leadPFCH;
275  } else if (leadPFGamma.isNonnull() &&
276  leadPFGamma->pt() > leadObjecPtThreshold_) {
277  // Otherwise use the lead Gamma if it is above threshold
278  leadPFCand = leadPFGamma;
279  } else {
280  // If both are too low PT, just take the charged one
281  leadPFCand = leadPFCH;
282  }
283 
284  tau.setleadCand(leadPFCand);
285 
286  // Our cone axis is defined about the lead charged hadron
287  reco::Candidate::LorentzVector coneAxis = leadPFCH->p4();
288 
289  /***********************************************
290  ****** Cone Construction **********
291  ***********************************************/
292 
293  // Define the signal and isolation cone sizes for this jet and build filters
294  // to select elements in the given DeltaR regions
295 
296  CandPtrDRFilter signalConePFCHFilter(
297  coneAxis, -0.1, signalConeChargedHadrons_(*jet));
298  CandPtrDRFilter signalConePFNHFilter(
299  coneAxis, -0.1, signalConeNeutralHadrons_(*jet));
300  PiZeroDRFilter signalConePiZeroFilter(
301  coneAxis, -0.1, signalConePiZeros_(*jet));
302 
303  CandPtrDRFilter isoConePFCHFilter(
305  CandPtrDRFilter isoConePFGammaFilter(
306  coneAxis, signalConePiZeros_(*jet), isoConePiZeros_(*jet));
307  CandPtrDRFilter isoConePFNHFilter(
309  PiZeroDRFilter isoConePiZeroFilter(
310  coneAxis, signalConePiZeros_(*jet), isoConePiZeros_(*jet));
311 
312  // Additionally make predicates to select the different PF object types
313  // of the regional junk objects to add to the iso cone.
314  typedef xclean::PredicateAND<xclean::FilterCandByAbsPdgId, CandPtrDRFilter> RegionalJunkConeAndIdFilter;
315 
316  xclean::FilterCandByAbsPdgId pfchCandSelector(211);
317  xclean::FilterCandByAbsPdgId pfgammaCandSelector(22);
318  xclean::FilterCandByAbsPdgId pfnhCandSelector(130);
319 
320  // Predicate to select the regional junk in the iso cone by PF id
321  RegionalJunkConeAndIdFilter pfChargedJunk(
322  pfchCandSelector, // select charged stuff from junk
323  isoConePFCHFilter // only take those in iso cone
324  );
325 
326  RegionalJunkConeAndIdFilter pfGammaJunk(
327  pfgammaCandSelector, // select gammas from junk
328  isoConePFGammaFilter // only take those in iso cone
329  );
330 
331  RegionalJunkConeAndIdFilter pfNeutralJunk(
332  pfnhCandSelector, // select neutral stuff from junk
333  isoConePFNHFilter // select stuff in iso cone
334  );
335 
336  // Build filter iterators select the signal charged stuff.
337  CandPtrDRFilterIter signalPFCHCands_begin(
338  signalConePFCHFilter, pfchs.begin(), pfchs.end());
339  CandPtrDRFilterIter signalPFCHCands_end(
340  signalConePFCHFilter, pfchs.end(), pfchs.end());
341  CandPtrs signalPFCHs;
342  int numSignalPFCHs = 0;
343  CandPtrs isolationPFCHs;
344  int numIsolationPFCHs = 0;
345  for ( CandPtrDRFilterIter iter = signalPFCHCands_begin; iter != signalPFCHCands_end; ++iter ) {
346  if ( numSignalPFCHs < maxSignalConeChargedHadrons_ || maxSignalConeChargedHadrons_ == -1 ) {
347  //std::cout << "adding signalPFCH #" << numSignalPFCHs << ": Pt = " << (*iter)->pt() << ", eta = " << (*iter)->eta() << ", phi = " << (*iter)->phi() << std::endl;
348  signalPFCHs.push_back(*iter);
349  ++numSignalPFCHs;
350  } else {
351  //std::cout << "maxSignalConeChargedHadrons reached"
352  // << " --> adding isolationPFCH #" << numIsolationPFCHs << ": Pt = " << (*iter)->pt() << ", eta = " << (*iter)->eta() << ", phi = " << (*iter)->phi() << std::endl;
353  isolationPFCHs.push_back(*iter);
354  ++numIsolationPFCHs;
355  }
356  }
357  CandPtrs::const_iterator signalPFCHs_begin = signalPFCHs.begin();
358  CandPtrs::const_iterator signalPFCHs_end = signalPFCHs.end();
359 
360  // Cross clean pi zero content using signal cone charged hadron constituents.
361  xclean::CrossCleanPiZeros<CandPtrDRFilterIter> piZeroXCleaner(
362  signalPFCHCands_begin, signalPFCHCands_end);
363  std::vector<reco::RecoTauPiZero> cleanPiZeros = piZeroXCleaner(piZeros);
364 
365  // For the rest of the constituents, we need to filter any constituents that
366  // are already contained in the pizeros (i.e. electrons)
367  xclean::CrossCleanPtrs<PiZeroList::const_iterator> pfCandXCleaner(cleanPiZeros.begin(), cleanPiZeros.end());
368 
369  auto isolationPFCHCands_begin(
370  boost::make_filter_iterator(
371  xclean::makePredicateAND(isoConePFCHFilter, pfCandXCleaner),
372  pfchs.begin(), pfchs.end()));
373  auto isolationPFCHCands_end(
374  boost::make_filter_iterator(
375  xclean::makePredicateAND(isoConePFCHFilter, pfCandXCleaner),
376  pfchs.end(), pfchs.end()));
377  for ( auto iter = isolationPFCHCands_begin; iter != isolationPFCHCands_end; ++iter ) {
378  //std::cout << "adding isolationPFCH #" << numIsolationPFCHs << ": Pt = " << (*iter)->pt() << ", eta = " << (*iter)->eta() << ", phi = " << (*iter)->phi() << std::endl;
379  isolationPFCHs.push_back(*iter);
380  ++numIsolationPFCHs;
381  }
382  CandPtrs::const_iterator isolationPFCHs_begin = isolationPFCHs.begin();
383  CandPtrs::const_iterator isolationPFCHs_end = isolationPFCHs.end();
384 
385  // Build signal charged hadrons
386  tau.addPFCands(RecoTauConstructor::kSignal,
388  signalPFCHs_begin, signalPFCHs_end);
389 
390  tau.addPFCands(RecoTauConstructor::kSignal,
392  boost::make_filter_iterator(
393  xclean::makePredicateAND(signalConePFNHFilter, pfCandXCleaner),
394  pfnhs.begin(), pfnhs.end()),
395  boost::make_filter_iterator(
396  xclean::makePredicateAND(signalConePFNHFilter, pfCandXCleaner),
397  pfnhs.end(), pfnhs.end()));
398 
399  // Build signal PiZeros
400  tau.addPiZeros(RecoTauConstructor::kSignal,
401  PiZeroDRFilterIter(signalConePiZeroFilter,
402  cleanPiZeros.begin(), cleanPiZeros.end()),
403  PiZeroDRFilterIter(signalConePiZeroFilter,
404  cleanPiZeros.end(), cleanPiZeros.end()));
405 
406  // Build isolation charged hadrons
409  isolationPFCHs_begin, isolationPFCHs_end);
410 
411  // Add all the stuff in the isolation cone that wasn't in the jet constituents
414  boost::make_filter_iterator(
415  pfChargedJunk, regionalJunk.begin(), regionalJunk.end()),
416  boost::make_filter_iterator(
417  pfChargedJunk, regionalJunk.end(), regionalJunk.end())
418  );
419 
420  // Build isolation neutral hadrons
423  boost::make_filter_iterator(
424  xclean::makePredicateAND(isoConePFNHFilter, pfCandXCleaner),
425  pfnhs.begin(), pfnhs.end()),
426  boost::make_filter_iterator(
427  xclean::makePredicateAND(isoConePFNHFilter, pfCandXCleaner),
428  pfnhs.end(), pfnhs.end()));
429 
430  // Add regional stuff not in jet
433  boost::make_filter_iterator(
434  pfNeutralJunk, regionalJunk.begin(), regionalJunk.end()),
435  boost::make_filter_iterator(
436  pfNeutralJunk, regionalJunk.end(), regionalJunk.end())
437  );
438 
439  // Build isolation PiZeros
441  PiZeroDRFilterIter(isoConePiZeroFilter, cleanPiZeros.begin(),
442  cleanPiZeros.end()),
443  PiZeroDRFilterIter(isoConePiZeroFilter, cleanPiZeros.end(),
444  cleanPiZeros.end()));
445 
446  // Add regional stuff not in jet
449  boost::make_filter_iterator(
450  pfGammaJunk, regionalJunk.begin(), regionalJunk.end()),
451  boost::make_filter_iterator(
452  pfGammaJunk, regionalJunk.end(), regionalJunk.end())
453  );
454 
455  // Put our built tau in the output - 'false' indicates don't build the
456  // leading candidates, we already did that explicitly above.
457 
458  std::auto_ptr<reco::PFTau> tauPtr = tau.get(false);
459 
460  // Set event vertex position for tau
461  reco::VertexRef primaryVertexRef = primaryVertex(*tauPtr);
462  if ( primaryVertexRef.isNonnull() )
463  tauPtr->setVertex(primaryVertexRef->position());
464 
465  // Set missing tau quantities
466  setTauQuantities(*tauPtr,
469  );
470 
471  output.push_back(tauPtr);
472  return output.release();
473 }
reco::VertexRef primaryVertex(const reco::JetBaseRef &jet) const
Get primary vertex associated to this jet.
std::vector< CandidatePtr > pfCandidatesByPdgId(const Jet &jet, int pdgId, bool sort=true)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of Candidates.
boost::filter_iterator< PiZeroDRFilter, std::vector< RecoTauPiZero >::const_iterator > PiZeroDRFilterIter
Definition: ConeTools.h:61
boost::ptr_vector< reco::PFTau > output_type
std::vector< CandidatePtr > pfChargedCands(const Jet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
boost::filter_iterator< CandPtrDRFilter, std::vector< CandidatePtr >::const_iterator > CandPtrDRFilterIter
Definition: ConeTools.h:53
std::vector< reco::CandidatePtr > CandPtrs
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
void setTauQuantities(reco::PFTau &aTau, double minAbsPhotonSumPt_insideSignalCone=2.5, double minRelPhotonSumPt_insideSignalCone=0., double minAbsPhotonSumPt_outsideSignalCone=1.e+9, double minRelPhotonSumPt_outsideSignalCone=1.e+9) const
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
DeltaRPtrFilter< CandidatePtr > CandPtrDRFilter
Definition: ConeTools.h:51
DeltaRFilter< RecoTauPiZero > PiZeroDRFilter
Definition: ConeTools.h:59
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:37
const edm::Handle< edm::View< reco::Candidate > > & getPFCands() const
Hack to be able to convert Ptrs to Refs.
std::vector< CandidatePtr > pfGammas(const Jet &jet, bool sort=true)
Extract all pfGammas from a PFJet.
PredicateAND< P1, P2 > makePredicateAND(const P1 &p1, const P2 &p2)
void reco::tau::RecoTauBuilderConePlugin::setTauQuantities ( reco::PFTau aTau,
double  minAbsPhotonSumPt_insideSignalCone = 2.5,
double  minRelPhotonSumPt_insideSignalCone = 0.,
double  minAbsPhotonSumPt_outsideSignalCone = 1.e+9,
double  minRelPhotonSumPt_outsideSignalCone = 1.e+9 
) const
private

Definition at line 127 of file RecoTauBuilderConePlugin.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, reco::LeafCandidate::charge(), reco::deltaR(), symbols::dm, edm::Ptr< T >::isNonnull(), reco::PFTau::kNull, reco::PFTau::kOneProngNPiZero, reco::PFTau::kRareDecayMode, reco::PFTau::leadChargedHadrCand(), RecoTauCombinatoricProducer_cfi::maxPiZeros, min(), hpstanc_transforms::nCharged, hpstanc_transforms::nPiZeros, reco::Candidate::p4(), reco::LeafCandidate::p4(), muons2muons_cfi::photon, reco::Candidate::pt(), reco::LeafCandidate::pt(), reco::LeafCandidate::setCharge(), reco::PFTau::setDecayMode(), reco::LeafCandidate::setPdgId(), reco::PFTau::signalChargedHadrCands(), reco::PFTau::signalConeSize(), and reco::PFTau::signalPiZeroCandidates().

Referenced by operator()().

131  {
132  //MB: Set tau quantities which are computed by RecoTauConstructor::get()
133  // method with PFRecoTauChargedHadrons not used here
134 
135  // Set charge
136  int charge = 0;
137  int leadCharge = aTau.leadChargedHadrCand().isNonnull() ? aTau.leadChargedHadrCand()->charge() : 0;
138  const std::vector<reco::CandidatePtr>& pfChs = aTau.signalChargedHadrCands();
139  for(const reco::CandidatePtr& pfCh : pfChs){
140  charge += pfCh->charge();
141  }
142  charge = charge==0 ? leadCharge : charge;
143  aTau.setCharge(charge);
144 
145  // Set PDG id
146  aTau.setPdgId(aTau.charge() < 0 ? 15 : -15);
147 
148  // Set Decay Mode
150  unsigned int nPiZeros = 0;
151  const std::vector<RecoTauPiZero>& piZeros = aTau.signalPiZeroCandidates();
152  for(const RecoTauPiZero& piZero : piZeros) {
153  double photonSumPt_insideSignalCone = 0.;
154  double photonSumPt_outsideSignalCone = 0.;
155  int numPhotons = piZero.numberOfDaughters();
156  for(int idxPhoton = 0; idxPhoton < numPhotons; ++idxPhoton) {
157  const reco::Candidate* photon = piZero.daughter(idxPhoton);
158  double dR = deltaR(photon->p4(), aTau.p4());
159  if(dR < aTau.signalConeSize() ){
160  photonSumPt_insideSignalCone += photon->pt();
161  } else {
162  photonSumPt_outsideSignalCone += photon->pt();
163  }
164  }
165  if( photonSumPt_insideSignalCone > minAbsPhotonSumPt_insideSignalCone || photonSumPt_insideSignalCone > (minRelPhotonSumPt_insideSignalCone*aTau.pt()) ||
166  photonSumPt_outsideSignalCone > minAbsPhotonSumPt_outsideSignalCone || photonSumPt_outsideSignalCone > (minRelPhotonSumPt_outsideSignalCone*aTau.pt()) ) ++nPiZeros;
167  }
168  // Find the maximum number of PiZeros our parameterization can hold
169  const unsigned int maxPiZeros = PFTau::kOneProngNPiZero;
170  // Determine our track index
171  unsigned int nCharged = pfChs.size();
172  if(nCharged>0){
173  unsigned int trackIndex = (nCharged - 1)*(maxPiZeros + 1);
174  // Check if we handle the given number of tracks
175  if(trackIndex >= PFTau::kRareDecayMode)
176  dm = PFTau::kRareDecayMode;
177  else
178  dm = static_cast<PFTau::hadronicDecayMode>(trackIndex + std::min(nPiZeros,maxPiZeros) );
179  }
180  else{
181  dm = PFTau::kNull;
182  }
183  aTau.setDecayMode(dm);
184  return;
185 }
double pt() const final
transverse momentum
int charge() const final
electric charge
Definition: LeafCandidate.h:91
void setCharge(Charge q) final
set electric charge
Definition: LeafCandidate.h:93
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
const CandidatePtr & leadChargedHadrCand() const
Definition: PFTau.cc:67
const std::vector< RecoTauPiZero > & signalPiZeroCandidates() const
Retrieve the association of signal region gamma candidates into candidate PiZeros.
Definition: PFTau.cc:230
void setDecayMode(const hadronicDecayMode &)
Definition: PFTau.cc:317
const LorentzVector & p4() const final
four-momentum Lorentz vector
Definition: LeafCandidate.h:99
T min(T a, T b)
Definition: MathUtil.h:58
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:168
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:28
virtual double pt() const =0
transverse momentum
double signalConeSize() const
Size of signal cone.
Definition: PFTau.h:172
const std::vector< reco::CandidatePtr > & signalChargedHadrCands() const
Charged hadrons in signal region.
Definition: PFTau.cc:80
hadronicDecayMode
Definition: PFTau.h:36
void setPdgId(int pdgId) final

Member Data Documentation

JetFunc reco::tau::RecoTauBuilderConePlugin::isoConeChargedHadrons_
private

Definition at line 56 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::isoConeNeutralHadrons_
private

Definition at line 61 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::isoConePiZeros_
private

Definition at line 59 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

double reco::tau::RecoTauBuilderConePlugin::leadObjecPtThreshold_
private

Definition at line 48 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::matchingCone_
private

Definition at line 54 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

int reco::tau::RecoTauBuilderConePlugin::maxSignalConeChargedHadrons_
private

Definition at line 63 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

double reco::tau::RecoTauBuilderConePlugin::minAbsPhotonSumPt_insideSignalCone_
private

Definition at line 64 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

double reco::tau::RecoTauBuilderConePlugin::minRelPhotonSumPt_insideSignalCone_
private

Definition at line 65 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

RecoTauQualityCuts reco::tau::RecoTauBuilderConePlugin::qcuts_
private

Definition at line 44 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::signalConeChargedHadrons_
private

Definition at line 55 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::signalConeNeutralHadrons_
private

Definition at line 60 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

JetFunc reco::tau::RecoTauBuilderConePlugin::signalConePiZeros_
private

Definition at line 57 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

StringObjectFunction<reco::PFTau> reco::tau::RecoTauBuilderConePlugin::signalConeSizeToStore_
private

Definition at line 58 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

bool reco::tau::RecoTauBuilderConePlugin::usePFLeptonsAsChargedHadrons_
private

Definition at line 46 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().