CMS 3D CMS Logo

RecoTauBuilderCombinatoricPlugin.cc
Go to the documentation of this file.
1 #include <vector>
2 
5 
9 
11 
18 
19 #include <algorithm>
20 
21 namespace reco { namespace tau {
22 
23 typedef std::vector<reco::PFRecoTauChargedHadron> ChargedHadronList;
25 typedef std::vector<RecoTauPiZero> PiZeroList;
27 
29 {
30  public:
33 
35  const reco::PFJetRef&,
36  const std::vector<reco::PFRecoTauChargedHadron>&,
37  const std::vector<RecoTauPiZero>&,
38  const std::vector<PFCandidatePtr>&) const override;
39 
40  private:
42 
44 
45  struct decayModeInfo
46  {
47  uint32_t maxPiZeros_;
48  uint32_t maxPFCHs_;
49  uint32_t nCharged_;
50  uint32_t nPiZeros_;
51  };
52  std::vector<decayModeInfo> decayModesToBuild_;
53 
59 
61 };
62 
64  : RecoTauBuilderPlugin(pset, std::move(iC)),
65  qcuts_(pset.getParameterSet("qualityCuts").getParameterSet("signalQualityCuts")),
66  isolationConeSize_(pset.getParameter<double>("isolationConeSize")),
67  signalConeSize_(pset.getParameter<std::string>("signalConeSize")),
68  minAbsPhotonSumPt_insideSignalCone_(pset.getParameter<double>("minAbsPhotonSumPt_insideSignalCone")),
69  minRelPhotonSumPt_insideSignalCone_(pset.getParameter<double>("minRelPhotonSumPt_insideSignalCone")),
70  minAbsPhotonSumPt_outsideSignalCone_(pset.getParameter<double>("minAbsPhotonSumPt_outsideSignalCone")),
71  minRelPhotonSumPt_outsideSignalCone_(pset.getParameter<double>("minRelPhotonSumPt_outsideSignalCone"))
72 {
73  typedef std::vector<edm::ParameterSet> VPSet;
74  const VPSet& decayModes = pset.getParameter<VPSet>("decayModes");
75  for ( VPSet::const_iterator decayMode = decayModes.begin();
76  decayMode != decayModes.end(); ++decayMode ) {
78  info.nCharged_ = decayMode->getParameter<uint32_t>("nCharged");
79  info.nPiZeros_ = decayMode->getParameter<uint32_t>("nPiZeros");
80  info.maxPFCHs_ = decayMode->getParameter<uint32_t>("maxTracks");
81  info.maxPiZeros_ = decayMode->getParameter<uint32_t>("maxPiZeros");
82  decayModesToBuild_.push_back(info);
83  }
84 
85  verbosity_ = ( pset.exists("verbosity") ) ?
86  pset.getParameter<int>("verbosity") : 0;
87 }
88 
89 // define template specialization for cross-cleaning
90 namespace xclean
91 {
92  template<>
94  {
95  // Get the list of objects we need to clean
96  for ( ChargedHadronCombo::combo_iterator chargedHadron = chargedHadronsBegin; chargedHadron != chargedHadronsEnd; ++chargedHadron ) {
97  // CV: Remove PFGammas that are merged into TauChargedHadrons from isolation PiZeros, but not from signal PiZeros.
98  // The overlap between PFGammas contained in signal PiZeros and merged into TauChargedHadrons
99  // is resolved by RecoTauConstructor::addTauChargedHadron,
100  // which gives preference to PFGammas that are within PiZeros and removes those PFGammas from TauChargedHadrons.
101  if ( mode_ == kRemoveChargedDaughterOverlaps ) {
102  if ( chargedHadron->getChargedPFCandidate().isNonnull() ) toRemove_.insert(reco::CandidatePtr(chargedHadron->getChargedPFCandidate()));
103  } else if ( mode_ == kRemoveChargedAndNeutralDaughterOverlaps ) {
104  const reco::CompositePtrCandidate::daughters& daughters = chargedHadron->daughterPtrVector();
105  for ( reco::CompositePtrCandidate::daughters::const_iterator daughter = daughters.begin();
106  daughter != daughters.end(); ++daughter ) {
107  toRemove_.insert(reco::CandidatePtr(*daughter));
108  }
109  } else assert(0);
110  }
111  }
112 
113  template<>
114  inline void CrossCleanPtrs<PiZeroList::const_iterator>::initialize(const PiZeroList::const_iterator& piZerosBegin, const PiZeroList::const_iterator& piZerosEnd)
115  {
116  BOOST_FOREACH( const PFCandidatePtr &ptr, flattenPiZeros(piZerosBegin, piZerosEnd) ) {
117  toRemove_.insert(CandidatePtr(ptr));
118  }
119  }
120 
121  template<>
123  {
124  //std::cout << "<CrossCleanPtrs<ChargedHadronCombo>::initialize>:" << std::endl;
125  for ( ChargedHadronCombo::combo_iterator chargedHadron = chargedHadronsBegin; chargedHadron != chargedHadronsEnd; ++chargedHadron ) {
126  const reco::CompositePtrCandidate::daughters& daughters = chargedHadron->daughterPtrVector();
127  for ( reco::CompositePtrCandidate::daughters::const_iterator daughter = daughters.begin();
128  daughter != daughters.end(); ++daughter ) {
129  //std::cout << " adding PFCandidate = " << daughter->id() << ":" << daughter->key() << std::endl;
130  toRemove_.insert(reco::CandidatePtr(*daughter));
131  }
132  }
133  }
134 
135  template<>
136  inline void CrossCleanPtrs<ChargedHadronList::const_iterator>::initialize(const ChargedHadronList::const_iterator& chargedHadronsBegin, const ChargedHadronList::const_iterator& chargedHadronsEnd)
137  {
138  //std::cout << "<CrossCleanPtrs<ChargedHadronList>::initialize>:" << std::endl;
139  for ( ChargedHadronList::const_iterator chargedHadron = chargedHadronsBegin; chargedHadron != chargedHadronsEnd; ++chargedHadron ) {
140  const reco::CompositePtrCandidate::daughters& daughters = chargedHadron->daughterPtrVector();
141  for ( reco::CompositePtrCandidate::daughters::const_iterator daughter = daughters.begin();
142  daughter != daughters.end(); ++daughter ) {
143  //std::cout << " adding PFCandidate = " << daughter->id() << ":" << daughter->key() << std::endl;
144  toRemove_.insert(reco::CandidatePtr(*daughter));
145  }
146  }
147  }
148 }
149 
150 namespace
151 {
152  // auxiliary class for sorting pizeros by descending transverse momentum
153  class SortPi0sDescendingPt
154  {
155  public:
156  bool operator()(const RecoTauPiZero& a, const RecoTauPiZero& b) const
157  {
158  return a.pt() > b.pt();
159  }
160  };
161 
162  double square(double x)
163  {
164  return x*x;
165  }
166 }
167 
170  const reco::PFJetRef& jet,
171  const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons,
172  const std::vector<RecoTauPiZero>& piZeros,
173  const std::vector<PFCandidatePtr>& regionalExtras) const
174 {
175  if ( verbosity_ ) {
176  std::cout << "<RecoTauBuilderCombinatoricPlugin::operator()>:" << std::endl;
177  std::cout << " processing jet: Pt = " << jet->pt() << ", eta = " << jet->eta() << ", phi = " << jet->eta() << ","
178  << " mass = " << jet->mass() << ", area = " << jet->jetArea() << std::endl;
179  }
180 
181  // Define output.
183 
184  // Update the primary vertex used by the quality cuts. The PV is supplied by
185  // the base class.
186  qcuts_.setPV( primaryVertex(jet) );
187 
188  typedef std::vector<PFCandidatePtr> PFCandPtrs;
189 
190  if ( verbosity_ ) {
191  std::cout << "#chargedHadrons = " << chargedHadrons.size() << std::endl;
192  int idx = 0;
193  for ( ChargedHadronList::const_iterator chargedHadron = chargedHadrons.begin();
194  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
195  std::cout << "chargedHadron #" << idx << ":" << std::endl;
196  chargedHadron->print(std::cout);
197  ++idx;
198  }
199  std::cout << "#piZeros = " << piZeros.size() << std::endl;
200  idx = 0;
201  for ( PiZeroList::const_iterator piZero = piZeros.begin();
202  piZero != piZeros.end(); ++piZero ) {
203  std::cout << "piZero #" << idx << ":" << std::endl;
204  piZero->print(std::cout);
205  ++idx;
206  }
207  }
208 
209  PFCandPtrs pfchs = qcuts_.filterCandRefs(pfChargedCands(*jet));
210  PFCandPtrs pfnhs = qcuts_.filterCandRefs(pfCandidates(*jet, reco::PFCandidate::h0));
211  PFCandPtrs pfgammas = qcuts_.filterCandRefs(pfCandidates(*jet, reco::PFCandidate::gamma));
212 
215  PFCandPtrs regionalJunk = qcuts_.filterCandRefs(regionalExtras);
216 
217  // Loop over the decay modes we want to build
218  for ( std::vector<decayModeInfo>::const_iterator decayMode = decayModesToBuild_.begin();
219  decayMode != decayModesToBuild_.end(); ++decayMode ) {
220  // Find how many piZeros are in this decay mode
221  size_t piZerosToBuild = decayMode->nPiZeros_;
222  // Find how many tracks are in this decay mode
223  size_t tracksToBuild = decayMode->nCharged_;
224  if ( verbosity_ ) {
225  std::cout << "piZerosToBuild = " << piZerosToBuild << std::endl;
226  std::cout << "#piZeros = " << piZeros.size() << std::endl;
227  std::cout << "tracksToBuild = " << tracksToBuild << std::endl;
228  std::cout << "#chargedHadrons = " << chargedHadrons.size() << std::endl;
229  }
230 
231  // Skip decay mode if jet doesn't have the multiplicity to support it
232  if ( chargedHadrons.size() < tracksToBuild ) continue;
233 
234  // Find the start and end of potential signal tracks
235  ChargedHadronList::const_iterator chargedHadron_begin = chargedHadrons.begin();
236  ChargedHadronList::const_iterator chargedHadron_end = chargedHadrons.end();
237  chargedHadron_end = takeNElements(chargedHadron_begin, chargedHadron_end, decayMode->maxPFCHs_);
238 
239  // Build our track combo generator
240  ChargedHadronCombo trackCombos(chargedHadron_begin, chargedHadron_end, tracksToBuild);
241 
242  PFCandPtrs::iterator pfch_end = pfchs.end();
243  pfch_end = takeNElements(pfchs.begin(), pfch_end, decayMode->maxPFCHs_);
244 
245  //-------------------------------------------------------
246  // Begin combinatoric loop for this decay mode
247  //-------------------------------------------------------
248 
249  // Loop over the different combinations of tracks
250  for ( ChargedHadronCombo::iterator trackCombo = trackCombos.begin();
251  trackCombo != trackCombos.end(); ++trackCombo ) {
253  trackCombo->combo_begin(), trackCombo->combo_end(),
255 
256  PiZeroList cleanSignalPiZeros = signalPiZeroXCleaner(piZeros);
257 
258  // CV: sort collection of cross-cleaned pi0s by descending Pt
259  std::sort(cleanSignalPiZeros.begin(), cleanSignalPiZeros.end(), SortPi0sDescendingPt());
260 
261  // Skip decay mode if we don't have enough remaining clean pizeros to
262  // build it.
263  if ( cleanSignalPiZeros.size() < piZerosToBuild ) continue;
264 
265  // Find the start and end of potential signal tracks
266  PiZeroList::iterator signalPiZero_begin = cleanSignalPiZeros.begin();
267  PiZeroList::iterator signalPiZero_end = cleanSignalPiZeros.end();
268  signalPiZero_end = takeNElements(signalPiZero_begin, signalPiZero_end, decayMode->maxPiZeros_);
269 
270  // Build our piZero combo generator
271  PiZeroCombo piZeroCombos(signalPiZero_begin, signalPiZero_end, piZerosToBuild);
272  // Loop over the different combinations of PiZeros
273  for ( PiZeroCombo::iterator piZeroCombo = piZeroCombos.begin();
274  piZeroCombo != piZeroCombos.end(); ++piZeroCombo ) {
275  // Output tau
277  jet, getPFCands(), true,
278  &signalConeSize_,
280  // Reserve space in our collections
281  tau.reserve(
283  RecoTauConstructor::kChargedHadron, tracksToBuild);
284  tau.reserve(
286  RecoTauConstructor::kGamma, 2*piZerosToBuild); // k-factor = 2
287  tau.reservePiZero(RecoTauConstructor::kSignal, piZerosToBuild);
288 
290  trackCombo->combo_begin(), trackCombo->combo_end(),
292 
293  PiZeroList precleanedIsolationPiZeros = isolationPiZeroXCleaner(piZeros);
294  std::set<reco::CandidatePtr> toRemove;
295  for ( PiZeroCombo::combo_iterator signalPiZero = piZeroCombo->combo_begin();
296  signalPiZero != piZeroCombo->combo_end(); ++signalPiZero ) {
297  toRemove.insert(signalPiZero->daughterPtrVector().begin(), signalPiZero->daughterPtrVector().end());
298  }
299  PiZeroList cleanIsolationPiZeros;
300  BOOST_FOREACH( const RecoTauPiZero& precleanedPiZero, precleanedIsolationPiZeros ) {
301  std::set<reco::CandidatePtr> toCheck(precleanedPiZero.daughterPtrVector().begin(), precleanedPiZero.daughterPtrVector().end());
302  std::vector<reco::CandidatePtr> cleanDaughters;
303  std::set_difference(toCheck.begin(), toCheck.end(), toRemove.begin(), toRemove.end(), std::back_inserter(cleanDaughters));
304  // CV: piZero is signal piZero if at least one daughter overlaps
305  if ( cleanDaughters.size() == precleanedPiZero.daughterPtrVector().size() ) {
306  cleanIsolationPiZeros.push_back(precleanedPiZero);
307  }
308  }
309  if ( verbosity_ ) {
310  std::cout << "#cleanIsolationPiZeros = " << cleanIsolationPiZeros.size() << std::endl;
311  int idx = 0;
312  for ( PiZeroList::const_iterator piZero = cleanIsolationPiZeros.begin();
313  piZero != cleanIsolationPiZeros.end(); ++piZero ) {
314  std::cout << "piZero #" << idx << ":" << std::endl;
315  piZero->print(std::cout);
316  ++idx;
317  }
318  }
319 
320  // FIXME - are all these reserves okay? will they get propagated to the
321  // dataformat size if they are wrong?
322  tau.reserve(
324  RecoTauConstructor::kChargedHadron, chargedHadrons.size() - tracksToBuild);
325  tau.reserve(
328  (piZeros.size() - piZerosToBuild)*2);
329  tau.reservePiZero(
331  (piZeros.size() - piZerosToBuild));
332 
333  // Get signal PiZero constituents and add them to the tau.
334  // The sub-gammas are automatically added.
335  tau.addPiZeros(
337  piZeroCombo->combo_begin(), piZeroCombo->combo_end());
338 
339  // Set signal and isolation components for charged hadrons, after
340  // converting them to a PFCandidateRefVector
341  //
342  // NOTE: signal ChargedHadrons need to be added **after** signal PiZeros
343  // to avoid double-counting PFGammas as part of PiZero and merged with ChargedHadron
344  //
347  trackCombo->combo_begin(), trackCombo->combo_end());
348 
349  // Now build isolation collections
350  // Load our isolation tools
351  using namespace reco::tau::cone;
352  PFCandPtrDRFilter isolationConeFilter(tau.p4(), -0.1, isolationConeSize_);
353 
354  // Cross cleaning predicate: Remove any PFCandidatePtrs that are contained within existing ChargedHadrons or PiZeros.
355  // The predicate will return false for any object that overlaps with chargedHadrons or cleanPiZeros.
356  // 1.) to select charged PFCandidates within jet that are not signalPFChargedHadrons
357  typedef xclean::CrossCleanPtrs<ChargedHadronCombo::combo_iterator> pfChargedHadronXCleanerType;
358  pfChargedHadronXCleanerType pfChargedHadronXCleaner_comboChargedHadrons(trackCombo->combo_begin(), trackCombo->combo_end());
359  // And this cleaning filter predicate with our Iso cone filter
360  xclean::PredicateAND<PFCandPtrDRFilter, pfChargedHadronXCleanerType> pfCandFilter_comboChargedHadrons(isolationConeFilter, pfChargedHadronXCleaner_comboChargedHadrons);
361  // 2.) to select neutral PFCandidates within jet
362  xclean::CrossCleanPtrs<ChargedHadronList::const_iterator> pfChargedHadronXCleaner_allChargedHadrons(chargedHadrons.begin(), chargedHadrons.end());
363  xclean::CrossCleanPtrs<PiZeroList::const_iterator> piZeroXCleaner(piZeros.begin(), piZeros.end());
365  pfCandXCleanerType pfCandXCleaner_allChargedHadrons(pfChargedHadronXCleaner_allChargedHadrons, piZeroXCleaner);
366  // And this cleaning filter predicate with our Iso cone filter
367  xclean::PredicateAND<PFCandPtrDRFilter, pfCandXCleanerType> pfCandFilter_allChargedHadrons(isolationConeFilter, pfCandXCleaner_allChargedHadrons);
368 
369  ChargedHadronDRFilter isolationConeFilterChargedHadron(tau.p4(), -0.1, isolationConeSize_);
370  PiZeroDRFilter isolationConeFilterPiZero(tau.p4(), -0.1, isolationConeSize_);
371 
372  // Additionally make predicates to select the different PF object types
373  // of the regional junk objects to add
375  PFCandPtrDRFilter> RegionalJunkConeAndIdFilter;
376 
377  xclean::FilterPFCandByParticleId
378  pfchCandSelector(reco::PFCandidate::h);
379  xclean::FilterPFCandByParticleId
380  pfgammaCandSelector(reco::PFCandidate::gamma);
381  xclean::FilterPFCandByParticleId
382  pfnhCandSelector(reco::PFCandidate::h0);
383 
384  RegionalJunkConeAndIdFilter pfChargedJunk(
385  pfchCandSelector, // select charged stuff from junk
386  isolationConeFilter); // only take those in iso cone
387 
388  RegionalJunkConeAndIdFilter pfGammaJunk(
389  pfgammaCandSelector, // select gammas from junk
390  isolationConeFilter); // only take those in iso cone
391 
392  RegionalJunkConeAndIdFilter pfNeutralJunk(
393  pfnhCandSelector, // select neutral stuff from junk
394  isolationConeFilter); // select stuff in iso cone
395 
396  tau.addPiZeros(
398  boost::make_filter_iterator(
399  isolationConeFilterPiZero,
400  cleanIsolationPiZeros.begin(), cleanIsolationPiZeros.end()),
401  boost::make_filter_iterator(
402  isolationConeFilterPiZero,
403  cleanIsolationPiZeros.end(), cleanIsolationPiZeros.end()));
404 
405  // Filter the isolation candidates in a DR cone
406  //
407  // NOTE: isolation ChargedHadrons need to be added **after** signal and isolation PiZeros
408  // to avoid double-counting PFGammas as part of PiZero and merged with ChargedHadron
409  //
410  if ( verbosity_ >= 2 ) {
411  std::cout << "adding isolation PFChargedHadrons from trackCombo:" << std::endl;
412  }
415  boost::make_filter_iterator(
416  isolationConeFilterChargedHadron,
417  trackCombo->remainder_begin(), trackCombo->remainder_end()),
418  boost::make_filter_iterator(
419  isolationConeFilterChargedHadron,
420  trackCombo->remainder_end(), trackCombo->remainder_end()));
421 
422  // Add all the candidates that weren't included in the combinatoric
423  // generation
424  if ( verbosity_ >= 2 ) {
425  std::cout << "adding isolation PFChargedHadrons not considered in trackCombo:" << std::endl;
426  }
427  tau.addPFCands(
429  boost::make_filter_iterator(
430  pfCandFilter_comboChargedHadrons,
431  pfch_end, pfchs.end()),
432  boost::make_filter_iterator(
433  pfCandFilter_comboChargedHadrons,
434  pfchs.end(), pfchs.end()));
435  // Add all charged candidates that are in the iso cone but weren't in the
436  // original PFJet
437  if ( verbosity_ >= 2 ) {
438  std::cout << "adding isolation PFChargedHadrons from 'regional junk':" << std::endl;
439  }
440  tau.addPFCands(
442  boost::make_filter_iterator(
443  pfChargedJunk, regionalJunk.begin(), regionalJunk.end()),
444  boost::make_filter_iterator(
445  pfChargedJunk, regionalJunk.end(), regionalJunk.end()));
446 
447  // Add all PFGamma constituents of the jet that are not part of a PiZero
448  if ( verbosity_ >= 2 ) {
449  std::cout << "adding isolation PFGammas not considered in PiZeros:" << std::endl;
450  }
451  tau.addPFCands(
453  boost::make_filter_iterator(
454  pfCandFilter_allChargedHadrons,
455  pfgammas.begin(), pfgammas.end()),
456  boost::make_filter_iterator(
457  pfCandFilter_allChargedHadrons,
458  pfgammas.end(), pfgammas.end()));
459  // Add all gammas that are in the iso cone but weren't in the
460  // orginal PFJet
461  tau.addPFCands(
463  boost::make_filter_iterator(
464  pfGammaJunk, regionalJunk.begin(), regionalJunk.end()),
465  boost::make_filter_iterator(
466  pfGammaJunk, regionalJunk.end(), regionalJunk.end()));
467 
468  // Add all the neutral hadron candidates to the isolation collection
469  tau.addPFCands(
471  boost::make_filter_iterator(
472  pfCandFilter_allChargedHadrons,
473  pfnhs.begin(), pfnhs.end()),
474  boost::make_filter_iterator(
475  pfCandFilter_allChargedHadrons,
476  pfnhs.end(), pfnhs.end()));
477  // Add all the neutral hadrons from the region collection that are in
478  // the iso cone to the tau
479  tau.addPFCands(
481  boost::make_filter_iterator(
482  pfNeutralJunk, regionalJunk.begin(), regionalJunk.end()),
483  boost::make_filter_iterator(
484  pfNeutralJunk, regionalJunk.end(), regionalJunk.end()));
485 
486  std::auto_ptr<reco::PFTau> tauPtr = tau.get(true);
487 
488  // Set event vertex position for tau
489  reco::VertexRef primaryVertexRef = primaryVertex(*tauPtr);
490  if ( primaryVertexRef.isNonnull() ) {
491  tauPtr->setVertex(primaryVertexRef->position());
492  }
493 
494  double tauEn = tauPtr->energy();
495  double tauPz = tauPtr->pz();
496  const double chargedPionMass = 0.13957; // GeV
497  double tauMass = std::max(tauPtr->mass(), chargedPionMass);
498  double bendCorrMass2 = 0.;
499  const std::vector<RecoTauPiZero>& piZeros = tauPtr->signalPiZeroCandidates();
500  for (auto const& piZero : piZeros ) {
501  double piZeroEn = piZero.energy();
502  double piZeroPx = piZero.px();
503  double piZeroPy = piZero.py();
504  double piZeroPz = piZero.pz();
505  double tau_wo_piZeroPx = tauPtr->px() - piZeroPx;
506  double tau_wo_piZeroPy = tauPtr->py() - piZeroPy;
507  // CV: Compute effect of varying strip four-vector by eta and phi correction on tau mass
508  // (derrivative of tau mass by strip eta, phi has been computed using Mathematica)
509  bendCorrMass2 += square(((piZeroPz*tauEn - piZeroEn*tauPz)/tauMass)*piZero.bendCorrEta());
510  bendCorrMass2 += square(((piZeroPy*tau_wo_piZeroPx - piZeroPx*tau_wo_piZeroPy)/tauMass)*piZero.bendCorrPhi());
511  }
512  //edm::LogPrint("RecoTauBuilderCombinatoricPlugin") << "bendCorrMass2 = " << sqrt(bendCorrMass2) << std::endl;
513  tauPtr->setBendCorrMass(sqrt(bendCorrMass2));
514 
515  output.push_back(tauPtr);
516  }
517  }
518  }
519 
520  return output.release();
521 }
522 
523 }} // end namespace reco::tau
524 
528  "RecoTauBuilderCombinatoricPlugin");
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
const edm::Handle< PFCandidateCollection > & getPFCands() const
Hack to be able to convert Ptrs to Refs.
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
static const TGPicture * info(bool iBackgroundIsBlack)
std::auto_ptr< reco::PFTau > get(bool setupLeadingCandidates=true)
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
void reserve(Region region, ParticleType type, size_t size)
Reserve a set amount of space for a given RefVector.
void addTauChargedHadrons(Region region, const InputIterator &begin, const InputIterator &end)
Add a list of charged hadrons to the input collection.
CombinatoricIterator< T > end()
Coll filterCandRefs(const Coll &refcoll, bool invert=false) const
Filter a ref vector of PFCandidates.
std::vector< reco::PFRecoTauChargedHadron > ChargedHadronList
ParameterSet const & getParameterSet(ParameterSetID const &id)
std::vector< reco::PFCandidatePtr > PFCandPtrs
bool exists(std::string const &parameterName) const
checks if a parameter exists
boost::ptr_vector< reco::PFTau > output_type
double pt() const final
transverse momentum
std::auto_ptr< output_type > return_type
RecoTauBuilderCombinatoricPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
virtual const daughters & daughterPtrVector() const
references to daughtes
tau::CombinatoricGenerator< PiZeroList > PiZeroCombo
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
void addPiZeros(Region region, const InputIterator &begin, const InputIterator &end)
Add a list of pizeros to the input collection.
reco::VertexRef primaryVertex(const reco::PFJetRef &jet) const
Get primary vertex associated to this jet.
void setPV(const reco::VertexRef &vtx) const
Update the primary vertex.
T sqrt(T t)
Definition: SSEVec.h:18
const reco::Candidate::LorentzVector & p4() const
void addPFCands(Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
tau::CombinatoricGenerator< ChargedHadronList > ChargedHadronCombo
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.
std::vector< CandidatePtr > daughters
collection of references to daughters
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
void reservePiZero(Region region, size_t size)
Reserve a set amount of space for the PiZeros.
double b
Definition: hdecay.h:120
static double square(double x)
return_type operator()(const reco::PFJetRef &, const std::vector< reco::PFRecoTauChargedHadron > &, const std::vector< RecoTauPiZero > &, const std::vector< PFCandidatePtr > &) const override
fixed size matrix
std::vector< PFCandidatePtr > pfChargedCands(const PFJet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
double a
Definition: hdecay.h:121
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< RecoTauPiZero > PiZeroList
def move(src, dest)
Definition: eostools.py:510
iterator::value_type::ValueIter combo_iterator
Transform a pizero to remove given candidates.
CombinatoricIterator< T > begin()