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  reco::VertexRef primaryVertexRef = primaryVertex(jet);
185 
186  // Update the primary vertex used by the quality cuts. The PV is supplied by
187  // the base class.
188  qcuts_.setPV(primaryVertexRef);
189 
190  typedef std::vector<PFCandidatePtr> PFCandPtrs;
191 
192  if ( verbosity_ ) {
193  std::cout << "#chargedHadrons = " << chargedHadrons.size() << std::endl;
194  int idx = 0;
195  for ( ChargedHadronList::const_iterator chargedHadron = chargedHadrons.begin();
196  chargedHadron != chargedHadrons.end(); ++chargedHadron ) {
197  std::cout << "chargedHadron #" << idx << ":" << std::endl;
198  chargedHadron->print(std::cout);
199  ++idx;
200  }
201  std::cout << "#piZeros = " << piZeros.size() << std::endl;
202  idx = 0;
203  for ( PiZeroList::const_iterator piZero = piZeros.begin();
204  piZero != piZeros.end(); ++piZero ) {
205  std::cout << "piZero #" << idx << ":" << std::endl;
206  piZero->print(std::cout);
207  ++idx;
208  }
209  }
210 
211  PFCandPtrs pfchs = qcuts_.filterCandRefs(pfChargedCands(*jet));
212  PFCandPtrs pfnhs = qcuts_.filterCandRefs(pfCandidates(*jet, reco::PFCandidate::h0));
213  PFCandPtrs pfgammas = qcuts_.filterCandRefs(pfCandidates(*jet, reco::PFCandidate::gamma));
214 
217  PFCandPtrs regionalJunk = qcuts_.filterCandRefs(regionalExtras);
218 
219  // Loop over the decay modes we want to build
220  for ( std::vector<decayModeInfo>::const_iterator decayMode = decayModesToBuild_.begin();
221  decayMode != decayModesToBuild_.end(); ++decayMode ) {
222  // Find how many piZeros are in this decay mode
223  size_t piZerosToBuild = decayMode->nPiZeros_;
224  // Find how many tracks are in this decay mode
225  size_t tracksToBuild = decayMode->nCharged_;
226  if ( verbosity_ ) {
227  std::cout << "piZerosToBuild = " << piZerosToBuild << std::endl;
228  std::cout << "#piZeros = " << piZeros.size() << std::endl;
229  std::cout << "tracksToBuild = " << tracksToBuild << std::endl;
230  std::cout << "#chargedHadrons = " << chargedHadrons.size() << std::endl;
231  }
232 
233  // Skip decay mode if jet doesn't have the multiplicity to support it
234  if ( chargedHadrons.size() < tracksToBuild ) continue;
235 
236  // Find the start and end of potential signal tracks
237  ChargedHadronList::const_iterator chargedHadron_begin = chargedHadrons.begin();
238  ChargedHadronList::const_iterator chargedHadron_end = chargedHadrons.end();
239  chargedHadron_end = takeNElements(chargedHadron_begin, chargedHadron_end, decayMode->maxPFCHs_);
240 
241  // Build our track combo generator
242  ChargedHadronCombo trackCombos(chargedHadron_begin, chargedHadron_end, tracksToBuild);
243 
244  PFCandPtrs::iterator pfch_end = pfchs.end();
245  pfch_end = takeNElements(pfchs.begin(), pfch_end, decayMode->maxPFCHs_);
246 
247  //-------------------------------------------------------
248  // Begin combinatoric loop for this decay mode
249  //-------------------------------------------------------
250 
251  // Loop over the different combinations of tracks
252  for ( ChargedHadronCombo::iterator trackCombo = trackCombos.begin();
253  trackCombo != trackCombos.end(); ++trackCombo ) {
255  trackCombo->combo_begin(), trackCombo->combo_end(),
257 
258  PiZeroList cleanSignalPiZeros = signalPiZeroXCleaner(piZeros);
259 
260  // CV: sort collection of cross-cleaned pi0s by descending Pt
261  std::sort(cleanSignalPiZeros.begin(), cleanSignalPiZeros.end(), SortPi0sDescendingPt());
262 
263  // Skip decay mode if we don't have enough remaining clean pizeros to
264  // build it.
265  if ( cleanSignalPiZeros.size() < piZerosToBuild ) continue;
266 
267  // Find the start and end of potential signal tracks
268  PiZeroList::iterator signalPiZero_begin = cleanSignalPiZeros.begin();
269  PiZeroList::iterator signalPiZero_end = cleanSignalPiZeros.end();
270  signalPiZero_end = takeNElements(signalPiZero_begin, signalPiZero_end, decayMode->maxPiZeros_);
271 
272  // Build our piZero combo generator
273  PiZeroCombo piZeroCombos(signalPiZero_begin, signalPiZero_end, piZerosToBuild);
274  // Loop over the different combinations of PiZeros
275  for ( PiZeroCombo::iterator piZeroCombo = piZeroCombos.begin();
276  piZeroCombo != piZeroCombos.end(); ++piZeroCombo ) {
277  // Output tau
279  jet, getPFCands(), true,
280  &signalConeSize_,
282  // Reserve space in our collections
283  tau.reserve(
285  RecoTauConstructor::kChargedHadron, tracksToBuild);
286  tau.reserve(
288  RecoTauConstructor::kGamma, 2*piZerosToBuild); // k-factor = 2
289  tau.reservePiZero(RecoTauConstructor::kSignal, piZerosToBuild);
290 
292  trackCombo->combo_begin(), trackCombo->combo_end(),
294 
295  PiZeroList precleanedIsolationPiZeros = isolationPiZeroXCleaner(piZeros);
296  std::set<reco::CandidatePtr> toRemove;
297  for ( PiZeroCombo::combo_iterator signalPiZero = piZeroCombo->combo_begin();
298  signalPiZero != piZeroCombo->combo_end(); ++signalPiZero ) {
299  toRemove.insert(signalPiZero->daughterPtrVector().begin(), signalPiZero->daughterPtrVector().end());
300  }
301  PiZeroList cleanIsolationPiZeros;
302  BOOST_FOREACH( const RecoTauPiZero& precleanedPiZero, precleanedIsolationPiZeros ) {
303  std::set<reco::CandidatePtr> toCheck(precleanedPiZero.daughterPtrVector().begin(), precleanedPiZero.daughterPtrVector().end());
304  std::vector<reco::CandidatePtr> cleanDaughters;
305  std::set_difference(toCheck.begin(), toCheck.end(), toRemove.begin(), toRemove.end(), std::back_inserter(cleanDaughters));
306  // CV: piZero is signal piZero if at least one daughter overlaps
307  if ( cleanDaughters.size() == precleanedPiZero.daughterPtrVector().size() ) {
308  cleanIsolationPiZeros.push_back(precleanedPiZero);
309  }
310  }
311  if ( verbosity_ ) {
312  std::cout << "#cleanIsolationPiZeros = " << cleanIsolationPiZeros.size() << std::endl;
313  int idx = 0;
314  for ( PiZeroList::const_iterator piZero = cleanIsolationPiZeros.begin();
315  piZero != cleanIsolationPiZeros.end(); ++piZero ) {
316  std::cout << "piZero #" << idx << ":" << std::endl;
317  piZero->print(std::cout);
318  ++idx;
319  }
320  }
321 
322  // FIXME - are all these reserves okay? will they get propagated to the
323  // dataformat size if they are wrong?
324  tau.reserve(
326  RecoTauConstructor::kChargedHadron, chargedHadrons.size() - tracksToBuild);
327  tau.reserve(
330  (piZeros.size() - piZerosToBuild)*2);
331  tau.reservePiZero(
333  (piZeros.size() - piZerosToBuild));
334 
335  // Get signal PiZero constituents and add them to the tau.
336  // The sub-gammas are automatically added.
337  tau.addPiZeros(
339  piZeroCombo->combo_begin(), piZeroCombo->combo_end());
340 
341  // Set signal and isolation components for charged hadrons, after
342  // converting them to a PFCandidateRefVector
343  //
344  // NOTE: signal ChargedHadrons need to be added **after** signal PiZeros
345  // to avoid double-counting PFGammas as part of PiZero and merged with ChargedHadron
346  //
349  trackCombo->combo_begin(), trackCombo->combo_end());
350 
351  // Now build isolation collections
352  // Load our isolation tools
353  using namespace reco::tau::cone;
354  PFCandPtrDRFilter isolationConeFilter(tau.p4(), -0.1, isolationConeSize_);
355 
356  // Cross cleaning predicate: Remove any PFCandidatePtrs that are contained within existing ChargedHadrons or PiZeros.
357  // The predicate will return false for any object that overlaps with chargedHadrons or cleanPiZeros.
358  // 1.) to select charged PFCandidates within jet that are not signalPFChargedHadrons
359  typedef xclean::CrossCleanPtrs<ChargedHadronCombo::combo_iterator> pfChargedHadronXCleanerType;
360  pfChargedHadronXCleanerType pfChargedHadronXCleaner_comboChargedHadrons(trackCombo->combo_begin(), trackCombo->combo_end());
361  // And this cleaning filter predicate with our Iso cone filter
362  xclean::PredicateAND<PFCandPtrDRFilter, pfChargedHadronXCleanerType> pfCandFilter_comboChargedHadrons(isolationConeFilter, pfChargedHadronXCleaner_comboChargedHadrons);
363  // 2.) to select neutral PFCandidates within jet
364  xclean::CrossCleanPtrs<ChargedHadronList::const_iterator> pfChargedHadronXCleaner_allChargedHadrons(chargedHadrons.begin(), chargedHadrons.end());
365  xclean::CrossCleanPtrs<PiZeroList::const_iterator> piZeroXCleaner(piZeros.begin(), piZeros.end());
367  pfCandXCleanerType pfCandXCleaner_allChargedHadrons(pfChargedHadronXCleaner_allChargedHadrons, piZeroXCleaner);
368  // And this cleaning filter predicate with our Iso cone filter
369  xclean::PredicateAND<PFCandPtrDRFilter, pfCandXCleanerType> pfCandFilter_allChargedHadrons(isolationConeFilter, pfCandXCleaner_allChargedHadrons);
370 
371  ChargedHadronDRFilter isolationConeFilterChargedHadron(tau.p4(), -0.1, isolationConeSize_);
372  PiZeroDRFilter isolationConeFilterPiZero(tau.p4(), -0.1, isolationConeSize_);
373 
374  // Additionally make predicates to select the different PF object types
375  // of the regional junk objects to add
377  PFCandPtrDRFilter> RegionalJunkConeAndIdFilter;
378 
379  xclean::FilterPFCandByParticleId
380  pfchCandSelector(reco::PFCandidate::h);
381  xclean::FilterPFCandByParticleId
382  pfgammaCandSelector(reco::PFCandidate::gamma);
383  xclean::FilterPFCandByParticleId
384  pfnhCandSelector(reco::PFCandidate::h0);
385 
386  RegionalJunkConeAndIdFilter pfChargedJunk(
387  pfchCandSelector, // select charged stuff from junk
388  isolationConeFilter); // only take those in iso cone
389 
390  RegionalJunkConeAndIdFilter pfGammaJunk(
391  pfgammaCandSelector, // select gammas from junk
392  isolationConeFilter); // only take those in iso cone
393 
394  RegionalJunkConeAndIdFilter pfNeutralJunk(
395  pfnhCandSelector, // select neutral stuff from junk
396  isolationConeFilter); // select stuff in iso cone
397 
398  tau.addPiZeros(
400  boost::make_filter_iterator(
401  isolationConeFilterPiZero,
402  cleanIsolationPiZeros.begin(), cleanIsolationPiZeros.end()),
403  boost::make_filter_iterator(
404  isolationConeFilterPiZero,
405  cleanIsolationPiZeros.end(), cleanIsolationPiZeros.end()));
406 
407  // Filter the isolation candidates in a DR cone
408  //
409  // NOTE: isolation ChargedHadrons need to be added **after** signal and isolation PiZeros
410  // to avoid double-counting PFGammas as part of PiZero and merged with ChargedHadron
411  //
412  if ( verbosity_ >= 2 ) {
413  std::cout << "adding isolation PFChargedHadrons from trackCombo:" << std::endl;
414  }
417  boost::make_filter_iterator(
418  isolationConeFilterChargedHadron,
419  trackCombo->remainder_begin(), trackCombo->remainder_end()),
420  boost::make_filter_iterator(
421  isolationConeFilterChargedHadron,
422  trackCombo->remainder_end(), trackCombo->remainder_end()));
423 
424  // Add all the candidates that weren't included in the combinatoric
425  // generation
426  if ( verbosity_ >= 2 ) {
427  std::cout << "adding isolation PFChargedHadrons not considered in trackCombo:" << std::endl;
428  }
429  tau.addPFCands(
431  boost::make_filter_iterator(
432  pfCandFilter_comboChargedHadrons,
433  pfch_end, pfchs.end()),
434  boost::make_filter_iterator(
435  pfCandFilter_comboChargedHadrons,
436  pfchs.end(), pfchs.end()));
437  // Add all charged candidates that are in the iso cone but weren't in the
438  // original PFJet
439  if ( verbosity_ >= 2 ) {
440  std::cout << "adding isolation PFChargedHadrons from 'regional junk':" << std::endl;
441  }
442  tau.addPFCands(
444  boost::make_filter_iterator(
445  pfChargedJunk, regionalJunk.begin(), regionalJunk.end()),
446  boost::make_filter_iterator(
447  pfChargedJunk, regionalJunk.end(), regionalJunk.end()));
448 
449  // Add all PFGamma constituents of the jet that are not part of a PiZero
450  if ( verbosity_ >= 2 ) {
451  std::cout << "adding isolation PFGammas not considered in PiZeros:" << std::endl;
452  }
453  tau.addPFCands(
455  boost::make_filter_iterator(
456  pfCandFilter_allChargedHadrons,
457  pfgammas.begin(), pfgammas.end()),
458  boost::make_filter_iterator(
459  pfCandFilter_allChargedHadrons,
460  pfgammas.end(), pfgammas.end()));
461  // Add all gammas that are in the iso cone but weren't in the
462  // orginal PFJet
463  tau.addPFCands(
465  boost::make_filter_iterator(
466  pfGammaJunk, regionalJunk.begin(), regionalJunk.end()),
467  boost::make_filter_iterator(
468  pfGammaJunk, regionalJunk.end(), regionalJunk.end()));
469 
470  // Add all the neutral hadron candidates to the isolation collection
471  tau.addPFCands(
473  boost::make_filter_iterator(
474  pfCandFilter_allChargedHadrons,
475  pfnhs.begin(), pfnhs.end()),
476  boost::make_filter_iterator(
477  pfCandFilter_allChargedHadrons,
478  pfnhs.end(), pfnhs.end()));
479  // Add all the neutral hadrons from the region collection that are in
480  // the iso cone to the tau
481  tau.addPFCands(
483  boost::make_filter_iterator(
484  pfNeutralJunk, regionalJunk.begin(), regionalJunk.end()),
485  boost::make_filter_iterator(
486  pfNeutralJunk, regionalJunk.end(), regionalJunk.end()));
487 
488  std::auto_ptr<reco::PFTau> tauPtr = tau.get(true);
489 
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
virtual double pt() const final
transverse momentum
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:252
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
std::auto_ptr< output_type > return_type
RecoTauBuilderCombinatoricPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
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.
T x() const
Cartesian x coordinate.
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
const daughters & daughterPtrVector() const
references to daughtes
#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()