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_
 
std::unique_ptr< RecoTauQualityCutsqcuts_
 
JetFunc signalConeChargedHadrons_
 
JetFunc signalConeNeutralHadrons_
 
JetFunc signalConePiZeros_
 
StringObjectFunction< reco::PFTausignalConeSizeToStore_
 
bool usePFLeptonsAsChargedHadrons_
 

Additional Inherited Members

- Public Types inherited from reco::tau::RecoTauBuilderPlugin
typedef std::vector< std::unique_ptr< reco::PFTau > > output_type
 
typedef output_type return_type
 

Detailed Description

Definition at line 35 of file RecoTauBuilderConePlugin.cc.

Member Typedef Documentation

◆ JetFunc

Definition at line 53 of file RecoTauBuilderConePlugin.cc.

Constructor & Destructor Documentation

◆ RecoTauBuilderConePlugin()

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

Definition at line 77 of file RecoTauBuilderConePlugin.cc.

79  qcuts_(new RecoTauQualityCuts(pset.getParameterSet("qualityCuts").getParameterSet("signalQualityCuts"))),
80  usePFLeptonsAsChargedHadrons_(pset.getParameter<bool>("usePFLeptons")),
81  leadObjecPtThreshold_(pset.getParameter<double>("leadObjectPt")),
82  matchingCone_(pset.getParameter<std::string>("matchingCone")),
83  signalConeChargedHadrons_(pset.getParameter<std::string>("signalConeChargedHadrons")),
84  isoConeChargedHadrons_(pset.getParameter<std::string>("isoConeChargedHadrons")),
85  signalConePiZeros_(pset.getParameter<std::string>("signalConePiZeros")),
86  signalConeSizeToStore_( //MB: stored inside PFTau and used to compte photon-pt-out-of-signal-cone and DM hypothsis
87  pset.getParameter<std::string>("signalConePiZeros")),
88  isoConePiZeros_(pset.getParameter<std::string>("isoConePiZeros")),
89  signalConeNeutralHadrons_(pset.getParameter<std::string>("signalConeNeutralHadrons")),
90  isoConeNeutralHadrons_(pset.getParameter<std::string>("isoConeNeutralHadrons")),
91  maxSignalConeChargedHadrons_(pset.getParameter<int>("maxSignalConeChargedHadrons")),
92  minAbsPhotonSumPt_insideSignalCone_(pset.getParameter<double>("minAbsPhotonSumPt_insideSignalCone")),
93  minRelPhotonSumPt_insideSignalCone_(pset.getParameter<double>("minRelPhotonSumPt_insideSignalCone"))
94 
95  {}
std::unique_ptr< RecoTauQualityCuts > qcuts_
StringObjectFunction< reco::PFTau > signalConeSizeToStore_
RecoTauBuilderPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
def move(src, dest)
Definition: eostools.py:511

◆ ~RecoTauBuilderConePlugin()

reco::tau::RecoTauBuilderConePlugin::~RecoTauBuilderConePlugin ( )
inlineoverride

Definition at line 38 of file RecoTauBuilderConePlugin.cc.

38 {}

Member Function Documentation

◆ operator()()

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 179 of file RecoTauBuilderConePlugin.cc.

References hltPFPuppi_cfi::cone, reco::tau::RecoTauBuilderPlugin::getPFCands(), edm::Ptr< T >::isNonnull(), edm::Ref< C, T, F >::isNonnull(), isoConeChargedHadrons_, isoConeNeutralHadrons_, isoConePiZeros_, metsig::jet, 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(), HLT_2022v15_cff::matchingCone, matchingCone_, maxSignalConeChargedHadrons_, minAbsPhotonSumPt_insideSignalCone_, minRelPhotonSumPt_insideSignalCone_, eostools::move(), convertSQLitetoXML_cfg::output, reco::tau::pfCandidatesByPdgId(), reco::tau::pfChargedCands(), reco::tau::pfGammas(), reco::tau::RecoTauBuilderPlugin::primaryVertex(), qcuts_, setTauQuantities(), signalConeChargedHadrons_, signalConeNeutralHadrons_, signalConePiZeros_, signalConeSizeToStore_, jetsAK4_CHS_cff::sort, metsig::tau, and usePFLeptonsAsChargedHadrons_.

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

◆ setTauQuantities()

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 117 of file RecoTauBuilderConePlugin.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, reco::LeafCandidate::charge(), reco::deltaR(), symbols::dm, HGC3DClusterGenMatchSelector_cfi::dR, edm::Ptr< T >::isNonnull(), reco::PFTau::kNull, reco::PFTau::kOneProngNPiZero, reco::PFTau::kRareDecayMode, reco::PFTau::leadChargedHadrCand(), HLT_2022v15_cff::maxPiZeros, SiStripPI::min, HLT_2022v15_cff::minAbsPhotonSumPt_insideSignalCone, HLT_2022v15_cff::minAbsPhotonSumPt_outsideSignalCone, HLT_2022v15_cff::minRelPhotonSumPt_insideSignalCone, HLT_2022v15_cff::minRelPhotonSumPt_outsideSignalCone, HLT_2022v15_cff::nCharged, HLT_2022v15_cff::nPiZeros, reco::LeafCandidate::p4(), displacedMuons_cfi::photon, 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()().

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

Member Data Documentation

◆ isoConeChargedHadrons_

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

Definition at line 58 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ isoConeNeutralHadrons_

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

Definition at line 63 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ isoConePiZeros_

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

Definition at line 61 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ leadObjecPtThreshold_

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

Definition at line 50 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ matchingCone_

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

Definition at line 56 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ maxSignalConeChargedHadrons_

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

Definition at line 65 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ minAbsPhotonSumPt_insideSignalCone_

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

Definition at line 66 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ minRelPhotonSumPt_insideSignalCone_

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

Definition at line 67 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ qcuts_

std::unique_ptr<RecoTauQualityCuts> reco::tau::RecoTauBuilderConePlugin::qcuts_
private

Definition at line 46 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ signalConeChargedHadrons_

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

Definition at line 57 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ signalConeNeutralHadrons_

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

Definition at line 62 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ signalConePiZeros_

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

Definition at line 59 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ signalConeSizeToStore_

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

Definition at line 60 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().

◆ usePFLeptonsAsChargedHadrons_

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

Definition at line 48 of file RecoTauBuilderConePlugin.cc.

Referenced by operator()().