CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
reco::tau::RecoTauConstructor Class Reference

#include <RecoTauConstructor.h>

Public Types

enum  ParticleType { kChargedHadron, kGamma, kNeutralHadron, kAll }
 
enum  Region { kSignal, kIsolation }
 

Public Member Functions

void addPFCand (Region region, ParticleType type, const CandidatePtr &ptr, bool skipAddToP4=false)
 Append a PFCandidateRef/Ptr to a given collection. More...
 
template<typename InputIterator >
void addPFCands (Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
 
void addPiZero (Region region, const RecoTauPiZero &piZero)
 Add a PiZero to the given collection. More...
 
template<typename InputIterator >
void addPiZeros (Region region, const InputIterator &begin, const InputIterator &end)
 Add a list of pizeros to the input collection. More...
 
void addTauChargedHadron (Region region, const PFRecoTauChargedHadron &chargedHadron)
 Add a ChargedHadron to the given collection. More...
 
template<typename InputIterator >
void addTauChargedHadrons (Region region, const InputIterator &begin, const InputIterator &end)
 Add a list of charged hadrons to the input collection. More...
 
std::auto_ptr< reco::PFTauget (bool setupLeadingCandidates=true)
 
const reco::Candidate::LorentzVectorp4 () const
 
 RecoTauConstructor (const JetBaseRef &jetRef, const edm::Handle< edm::View< reco::Candidate > > &pfCands, bool copyGammasFromPiZeros=false, const StringObjectFunction< reco::PFTau > *signalConeSize=0, double minAbsPhotonSumPt_insideSignalCone=2.5, double minRelPhotonSumPt_insideSignalCone=0., double minAbsPhotonSumPt_outsideSignalCone=1.e+9, double minRelPhotonSumPt_outsideSignalCone=1.e+9)
 Constructor with PFCandidate Handle. More...
 
void reserve (Region region, ParticleType type, size_t size)
 Reserve a set amount of space for a given RefVector. More...
 
void reservePiZero (Region region, size_t size)
 Reserve a set amount of space for the PiZeros. More...
 
void reserveTauChargedHadron (Region region, size_t size)
 Reserve a set amount of space for the ChargedHadrons. More...
 
template<typename T >
void setleadCand (const T &cand)
 Set leading PF candidate. More...
 
template<typename T >
void setleadChargedHadrCand (const T &cand)
 Set leading PFChargedHadron candidate. More...
 
template<typename T >
void setleadNeutralCand (const T &cand)
 Set leading PFGamma candidate. More...
 

Private Types

typedef std::pair< Region, ParticleTypeCollectionKey
 
typedef std::map< CollectionKey, std::vector< CandidatePtr > * > CollectionMap
 
typedef std::map< CollectionKey, SortedListPtrSortedCollectionMap
 
typedef boost::shared_ptr< std::vector< CandidatePtr > > SortedListPtr
 

Private Member Functions

CandidatePtr convertToPtr (const PFCandidatePtr &pfPtr) const
 
CandidatePtr convertToPtr (const CandidatePtr &candPtr) const
 
std::vector< CandidatePtr > * getCollection (Region region, ParticleType type)
 
SortedListPtr getSortedCollection (Region region, ParticleType type)
 
void sortAndCopyIntoTau ()
 

Private Attributes

CollectionMap collections_
 
bool copyGammas_
 
double minAbsPhotonSumPt_insideSignalCone_
 
double minAbsPhotonSumPt_outsideSignalCone_
 
double minRelPhotonSumPt_insideSignalCone_
 
double minRelPhotonSumPt_outsideSignalCone_
 
reco::Candidate::LorentzVector p4_
 
const edm::Handle< edm::View< reco::Candidate > > & pfCands_
 
const StringObjectFunction< reco::PFTau > * signalConeSize_
 
SortedCollectionMap sortedCollections_
 
std::auto_ptr< reco::PFTautau_
 

Detailed Description

Definition at line 40 of file RecoTauConstructor.h.

Member Typedef Documentation

Definition at line 133 of file RecoTauConstructor.h.

Definition at line 134 of file RecoTauConstructor.h.

Definition at line 136 of file RecoTauConstructor.h.

typedef boost::shared_ptr<std::vector<CandidatePtr> > reco::tau::RecoTauConstructor::SortedListPtr
private

Definition at line 135 of file RecoTauConstructor.h.

Member Enumeration Documentation

Enumerator
kSignal 
kIsolation 

Definition at line 42 of file RecoTauConstructor.h.

Constructor & Destructor Documentation

reco::tau::RecoTauConstructor::RecoTauConstructor ( const JetBaseRef jetRef,
const edm::Handle< edm::View< reco::Candidate > > &  pfCands,
bool  copyGammasFromPiZeros = false,
const StringObjectFunction< reco::PFTau > *  signalConeSize = 0,
double  minAbsPhotonSumPt_insideSignalCone = 2.5,
double  minRelPhotonSumPt_insideSignalCone = 0.,
double  minAbsPhotonSumPt_outsideSignalCone = 1.e+9,
double  minRelPhotonSumPt_outsideSignalCone = 1.e+9 
)

Constructor with PFCandidate Handle.

Definition at line 12 of file RecoTauConstructor.cc.

References collections_, copyGammas_, kAll, kChargedHadron, kGamma, kIsolation, kNeutralHadron, kSignal, RecoPFTauTag_cff::PFTau, sortedCollections_, and tau_.

17  : signalConeSize_(signalConeSize),
22  pfCands_(pfCands)
23 {
24  // Initialize tau
25  tau_.reset(new PFTau());
26 
27  copyGammas_ = copyGammasFromPiZeros;
28  // Initialize our Accessors
29  collections_[std::make_pair(kSignal, kChargedHadron)] =
30  &tau_->selectedSignalChargedHadrCands_;
31  collections_[std::make_pair(kSignal, kGamma)] =
32  &tau_->selectedSignalGammaCands_;
33  collections_[std::make_pair(kSignal, kNeutralHadron)] =
34  &tau_->selectedSignalNeutrHadrCands_;
35  collections_[std::make_pair(kSignal, kAll)] =
36  &tau_->selectedSignalCands_;
37 
38  collections_[std::make_pair(kIsolation, kChargedHadron)] =
39  &tau_->selectedIsolationChargedHadrCands_;
40  collections_[std::make_pair(kIsolation, kGamma)] =
41  &tau_->selectedIsolationGammaCands_;
42  collections_[std::make_pair(kIsolation, kNeutralHadron)] =
43  &tau_->selectedIsolationNeutrHadrCands_;
44  collections_[std::make_pair(kIsolation, kAll)] =
45  &tau_->selectedIsolationCands_;
46 
47  // Build our temporary sorted collections, since you can't use stl sorts on
48  // RefVectors
49  for(auto const& colkey : collections_) {
50  // Build an empty list for each collection
51  sortedCollections_[colkey.first] = SortedListPtr(
52  new SortedListPtr::element_type);
53  }
54 
55  tau_->setjetRef(jet);
56 }
const edm::Handle< edm::View< reco::Candidate > > & pfCands_
SortedCollectionMap sortedCollections_
boost::shared_ptr< std::vector< CandidatePtr > > SortedListPtr
std::auto_ptr< reco::PFTau > tau_
const StringObjectFunction< reco::PFTau > * signalConeSize_

Member Function Documentation

void reco::tau::RecoTauConstructor::addPFCand ( Region  region,
ParticleType  type,
const CandidatePtr ptr,
bool  skipAddToP4 = false 
)

Append a PFCandidateRef/Ptr to a given collection.

Definition at line 58 of file RecoTauConstructor.cc.

References copyGammas_, getSortedCollection(), kAll, kGamma, kSignal, LogDebug, and p4_.

Referenced by addPFCands(), addTauChargedHadron(), and setleadCand().

58  {
59  LogDebug("TauConstructorAddPFCand") << " region = " << region << ", type = " << type << ": Pt = " << ptr->pt() << ", eta = " << ptr->eta() << ", phi = " << ptr->phi();
60  if ( region == kSignal ) {
61  // Keep track of the four vector of the signal vector products added so far.
62  // If a photon add it if we are not using PiZeros to build the gammas
63  if ( ((type != kGamma) || !copyGammas_) && !skipAddToP4 ) {
64  LogDebug("TauConstructorAddPFCand") << "--> adding PFCand to tauP4." ;
65  p4_ += ptr->p4();
66  }
67  }
68  getSortedCollection(region, type)->push_back(ptr);
69  // Add to global collection
70  getSortedCollection(region, kAll)->push_back(ptr);
71 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
reco::Candidate::LorentzVector p4_
SortedListPtr getSortedCollection(Region region, ParticleType type)
template<typename InputIterator >
void reco::tau::RecoTauConstructor::addPFCands ( Region  region,
ParticleType  type,
const InputIterator &  begin,
const InputIterator &  end 
)
inline

Definition at line 91 of file RecoTauConstructor.h.

References addPFCand(), addTauChargedHadron(), muons2muons_cfi::chargedHadron, convertToPtr(), end, and reserveTauChargedHadron().

Referenced by addPiZero(), reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), and reco::tau::RecoTauBuilderConePlugin::operator()().

92  {
93  for(InputIterator iter = begin; iter != end; ++iter) {
94  addPFCand(region, type, convertToPtr(*iter));
95  }
96  }
void addPFCand(Region region, ParticleType type, const CandidatePtr &ptr, bool skipAddToP4=false)
Append a PFCandidateRef/Ptr to a given collection.
type
Definition: HCALResponse.h:21
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
CandidatePtr convertToPtr(const PFCandidatePtr &pfPtr) const
void reco::tau::RecoTauConstructor::addPiZero ( Region  region,
const RecoTauPiZero piZero 
)

Add a PiZero to the given collection.

Definition at line 186 of file RecoTauConstructor.cc.

References addPFCands(), copyGammas_, reco::CompositePtrCandidate::daughterPtrVector(), reco::LeafCandidate::eta(), kGamma, kIsolation, kSignal, LogDebug, reco::LeafCandidate::p4(), p4_, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), and tau_.

Referenced by addPiZeros(), and addTauChargedHadrons().

187 {
188  LogDebug("TauConstructorAddPi0") << " region = " << region << ": Pt = " << piZero.pt() << ", eta = " << piZero.eta() << ", phi = " << piZero.phi();
189  if ( region == kSignal ) {
190  tau_->signalPiZeroCandidatesRestricted().push_back(piZero);
191  // Copy the daughter gammas into the gamma collection if desired
192  if ( copyGammas_ ) {
193  // If we are using the pizeros to build the gammas, make sure we update
194  // the four vector correctly.
195  p4_ += piZero.p4();
196  addPFCands(kSignal, kGamma, piZero.daughterPtrVector().begin(),
197  piZero.daughterPtrVector().end());
198  }
199  } else {
200  tau_->isolationPiZeroCandidatesRestricted().push_back(piZero);
201  if ( copyGammas_ ) {
202  addPFCands(kIsolation, kGamma, piZero.daughterPtrVector().begin(),
203  piZero.daughterPtrVector().end());
204  }
205  }
206 }
#define LogDebug(id)
reco::Candidate::LorentzVector p4_
void addPFCands(Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
std::auto_ptr< reco::PFTau > tau_
template<typename InputIterator >
void reco::tau::RecoTauConstructor::addPiZeros ( Region  region,
const InputIterator &  begin,
const InputIterator &  end 
)
inline

Add a list of pizeros to the input collection.

Definition at line 119 of file RecoTauConstructor.h.

References addPiZero(), and end.

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), and reco::tau::RecoTauBuilderConePlugin::operator()().

120  {
121  for ( InputIterator iter = begin; iter != end; ++iter ) {
122  addPiZero(region, *iter);
123  }
124  }
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
void addPiZero(Region region, const RecoTauPiZero &piZero)
Add a PiZero to the given collection.
void reco::tau::RecoTauConstructor::addTauChargedHadron ( Region  region,
const PFRecoTauChargedHadron chargedHadron 
)

Add a ChargedHadron to the given collection.

Definition at line 122 of file RecoTauConstructor.cc.

References funct::abs(), addPFCand(), muons2muons_cfi::chargedHadron, g4TestGeometry_cfi::checkOverlap(), convertToPtr(), copyGammas_, reco::LeafCandidate::eta(), reco::PFRecoTauChargedHadron::getChargedPFCandidate(), reco::PFRecoTauChargedHadron::getNeutralPFCandidates(), getSortedCollection(), edm::Ptr< T >::isNonnull(), kChargedHadron, kGamma, kIsolation, kNeutralHadron, kSignal, LogDebug, reco::PFRecoTauChargedHadron::neutralPFCandidates_, reco::LeafCandidate::p4(), p4_, reco::LeafCandidate::phi(), reco::LeafCandidate::pt(), reco::tau::setChargedHadronP4(), and tau_.

Referenced by addPFCands(), and addTauChargedHadrons().

123 {
124  LogDebug("TauConstructorAddChH") << " region = " << region << ": Pt = " << chargedHadron.pt() << ", eta = " << chargedHadron.eta() << ", phi = " << chargedHadron.phi();
125  // CV: need to make sure that PFGammas merged with ChargedHadrons are not part of PiZeros
126  const std::vector<CandidatePtr>& neutrals = chargedHadron.getNeutralPFCandidates();
127  std::vector<CandidatePtr> neutrals_cleaned;
128  for ( std::vector<CandidatePtr>::const_iterator neutral = neutrals.begin();
129  neutral != neutrals.end(); ++neutral ) {
130  LogDebug("TauConstructorAddChH") << "neutral = " << neutral->id() << ":" << neutral->key();
131  bool isUnique = true;
132  if ( copyGammas_ ) checkOverlap(*neutral, *getSortedCollection(kSignal, kGamma), isUnique);
133  else checkOverlap(*neutral, tau_->signalPiZeroCandidatesRestricted(), isUnique);
134  if ( region == kIsolation ) {
135  if ( copyGammas_ ) checkOverlap(*neutral, *getSortedCollection(kIsolation, kGamma), isUnique);
136  else checkOverlap(*neutral, tau_->isolationPiZeroCandidatesRestricted(), isUnique);
137  }
138  LogDebug("TauConstructorAddChH") << "--> isUnique = " << isUnique;
139  if ( isUnique ) neutrals_cleaned.push_back(*neutral);
140  }
141  PFRecoTauChargedHadron chargedHadron_cleaned = chargedHadron;
142  if ( neutrals_cleaned.size() != neutrals.size() ) {
143  chargedHadron_cleaned.neutralPFCandidates_ = neutrals_cleaned;
144  setChargedHadronP4(chargedHadron_cleaned);
145  }
146  if ( region == kSignal ) {
147  tau_->signalTauChargedHadronCandidatesRestricted().push_back(chargedHadron_cleaned);
148  p4_ += chargedHadron_cleaned.p4();
149  if ( chargedHadron_cleaned.getChargedPFCandidate().isNonnull() ) {
150  addPFCand(kSignal, kChargedHadron, convertToPtr(chargedHadron_cleaned.getChargedPFCandidate()), true);
151  }
152  const std::vector<CandidatePtr>& neutrals = chargedHadron_cleaned.getNeutralPFCandidates();
153  for ( std::vector<CandidatePtr>::const_iterator neutral = neutrals.begin();
154  neutral != neutrals.end(); ++neutral ) {
155  if ( std::abs((*neutral)->pdgId()) == 22 ) addPFCand(kSignal, kGamma, convertToPtr(*neutral), true);
156  else if ( std::abs((*neutral)->pdgId()) == 130 ) addPFCand(kSignal, kNeutralHadron, convertToPtr(*neutral), true);
157  };
158  } else {
159  tau_->isolationTauChargedHadronCandidatesRestricted().push_back(chargedHadron_cleaned);
160  if ( chargedHadron_cleaned.getChargedPFCandidate().isNonnull() ) {
161  if ( std::abs(chargedHadron_cleaned.getChargedPFCandidate()->pdgId()) == 211 ) addPFCand(kIsolation, kChargedHadron, convertToPtr(chargedHadron_cleaned.getChargedPFCandidate()));
162  else if ( std::abs(chargedHadron_cleaned.getChargedPFCandidate()->pdgId()) == 130 ) addPFCand(kIsolation, kNeutralHadron, convertToPtr(chargedHadron_cleaned.getChargedPFCandidate()));
163  }
164  const std::vector<CandidatePtr>& neutrals = chargedHadron_cleaned.getNeutralPFCandidates();
165  for ( std::vector<CandidatePtr>::const_iterator neutral = neutrals.begin();
166  neutral != neutrals.end(); ++neutral ) {
167  if ( std::abs((*neutral)->pdgId()) == 22 ) addPFCand(kIsolation, kGamma, convertToPtr(*neutral));
168  else if ( std::abs((*neutral)->pdgId()) == 130 ) addPFCand(kIsolation, kNeutralHadron, convertToPtr(*neutral));
169  };
170  }
171 }
#define LogDebug(id)
void addPFCand(Region region, ParticleType type, const CandidatePtr &ptr, bool skipAddToP4=false)
Append a PFCandidateRef/Ptr to a given collection.
reco::Candidate::LorentzVector p4_
SortedListPtr getSortedCollection(Region region, ParticleType type)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::auto_ptr< reco::PFTau > tau_
def checkOverlap(process)
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
CandidatePtr convertToPtr(const PFCandidatePtr &pfPtr) const
template<typename InputIterator >
void reco::tau::RecoTauConstructor::addTauChargedHadrons ( Region  region,
const InputIterator &  begin,
const InputIterator &  end 
)
inline

Add a list of charged hadrons to the input collection.

Definition at line 105 of file RecoTauConstructor.h.

References addPiZero(), addTauChargedHadron(), end, and reservePiZero().

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()().

106  {
107  for ( InputIterator iter = begin; iter != end; ++iter ) {
108  addTauChargedHadron(region, *iter);
109  }
110  }
void addTauChargedHadron(Region region, const PFRecoTauChargedHadron &chargedHadron)
Add a ChargedHadron to the given collection.
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
CandidatePtr reco::tau::RecoTauConstructor::convertToPtr ( const PFCandidatePtr pfPtr) const
private

Definition at line 238 of file RecoTauConstructor.cc.

References a, b, edm::Ptr< T >::isNonnull(), edm::Ptr< T >::key(), and pfCands_.

Referenced by addPFCands(), addTauChargedHadron(), setleadCand(), setleadChargedHadrCand(), and setleadNeutralCand().

239  {
240  if(candPtr.isNonnull()) {
241  checkMatchedProductIds(candPtr, pfCands_);
242  return CandidatePtr(pfCands_, candPtr.key());
243  } else return PFCandidatePtr();
244 }
const edm::Handle< edm::View< reco::Candidate > > & pfCands_
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
edm::Ptr< PFCandidate > PFCandidatePtr
persistent Ptr to a PFCandidate
CandidatePtr reco::tau::RecoTauConstructor::convertToPtr ( const CandidatePtr candPtr) const
private

Definition at line 219 of file RecoTauConstructor.cc.

References Exception.

220  {
221  return pfPtr;
222 }
std::auto_ptr< reco::PFTau > reco::tau::RecoTauConstructor::get ( bool  setupLeadingCandidates = true)

Definition at line 329 of file RecoTauConstructor.cc.

References begin, ALCARECOTkAlJpsiMuMu_cff::charge, muons2muons_cfi::chargedHadron, symbols::dm, end, getCollection(), kAll, kChargedHadron, reco::PFRecoTauChargedHadron::kChargedPFCandidate, kGamma, kIsolation, kSignal, reco::PFRecoTauChargedHadron::kTrack, reco::tau::leadCand(), LogDebug, minAbsPhotonSumPt_insideSignalCone_, minAbsPhotonSumPt_outsideSignalCone_, minRelPhotonSumPt_insideSignalCone_, minRelPhotonSumPt_outsideSignalCone_, hpstanc_transforms::nCharged, p4_, signalConeSize_, sortAndCopyIntoTau(), reco::tau::sumPFCandPt(), and tau_.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), and reco::tau::RecoTauBuilderConePlugin::operator()().

330 {
331  LogDebug("TauConstructorGet") << "Start getting" ;
332 
333  // Copy the sorted collections into the interal tau refvectors
335 
336  // Setup all the important member variables of the tau
337  // Set charge of tau
338 // tau_->setCharge(
339 // sumPFCandCharge(getCollection(kSignal, kChargedHadron)->begin(),
340 // getCollection(kSignal, kChargedHadron)->end()));
341  // CV: take charge of highest pT charged hadron as charge of tau,
342  // in case tau does not have three reconstructed tracks
343  // (either because tau is reconstructed as 2prong or because PFRecoTauChargedHadron is built from a PFNeutralHadron)
344  unsigned int nCharged = 0;
345  int charge = 0;
346  double leadChargedHadronPt = 0.;
347  int leadChargedHadronCharge = 0;
348  for ( std::vector<PFRecoTauChargedHadron>::const_iterator chargedHadron = tau_->signalTauChargedHadronCandidatesRestricted().begin();
349  chargedHadron != tau_->signalTauChargedHadronCandidatesRestricted().end(); ++chargedHadron ) {
351  ++nCharged;
352  charge += chargedHadron->charge();
353  if ( chargedHadron->pt() > leadChargedHadronPt ) {
354  leadChargedHadronPt = chargedHadron->pt();
355  leadChargedHadronCharge = chargedHadron->charge();
356  }
357  }
358  }
359  if ( nCharged == 3 ) tau_->setCharge(charge);
360  else tau_->setCharge(leadChargedHadronCharge);
361 
362  // Set PDG id
363  tau_->setPdgId(tau_->charge() < 0 ? 15 : -15);
364 
365  // Set P4
366  tau_->setP4(p4_);
367 
368  // Set Decay Mode
369  double dRsignalCone = ( signalConeSize_ ) ? (*signalConeSize_)(*tau_) : 0.5;
370  tau_->setSignalConeSize(dRsignalCone);
371  PFTau::hadronicDecayMode dm = calculateDecayMode(
372  *tau_,
373  dRsignalCone,
375  tau_->setDecayMode(dm);
376 
377  LogDebug("TauConstructorGet") << "Pt = " << tau_->pt() << ", eta = " << tau_->eta() << ", phi = " << tau_->phi() << ", mass = " << tau_->mass() << ", dm = " << tau_->decayMode() ;
378 
379  // Set charged isolation quantities
380  tau_->setisolationPFChargedHadrCandsPtSum(
381  sumPFCandPt(
384 
385  // Set gamma isolation quantities
386  tau_->setisolationPFGammaCandsEtSum(
387  sumPFCandPt(
390 
391  // Set em fraction
392  tau_->setemFraction(sumPFCandPt(
394  getCollection(kSignal, kGamma)->end()) / tau_->pt());
395 
396  if ( setupLeadingObjects ) {
397  typedef std::vector<CandidatePtr>::const_iterator Iter;
398  // Find the highest PT object in the signal cone
399  Iter leadingCand = leadCand(
402 
403  if ( leadingCand != getCollection(kSignal, kAll)->end() )
404  tau_->setleadCand(*leadingCand);
405 
406  // Hardest charged object in signal cone
407  Iter leadingChargedCand = leadCand(
410 
411  if ( leadingChargedCand != getCollection(kSignal, kChargedHadron)->end() )
412  tau_->setleadChargedHadrCand(*leadingChargedCand);
413 
414  // Hardest gamma object in signal cone
415  Iter leadingGammaCand = leadCand(
418 
419  if(leadingGammaCand != getCollection(kSignal, kGamma)->end())
420  tau_->setleadNeutralCand(*leadingGammaCand);
421  }
422  return tau_;
423 }
#define LogDebug(id)
reco::Candidate::LorentzVector p4_
double sumPFCandPt(InputIterator begin, InputIterator end)
Sum the pT of a collection of PFCandidates.
std::vector< CandidatePtr > * getCollection(Region region, ParticleType type)
InputIterator leadCand(InputIterator begin, InputIterator end)
#define end
Definition: vmac.h:39
std::auto_ptr< reco::PFTau > tau_
hadronicDecayMode
Definition: PFTau.h:36
#define begin
Definition: vmac.h:32
const StringObjectFunction< reco::PFTau > * signalConeSize_
std::vector< CandidatePtr > * reco::tau::RecoTauConstructor::getCollection ( Region  region,
ParticleType  type 
)
private

Definition at line 209 of file RecoTauConstructor.cc.

References collections_.

Referenced by get(), and reserve().

209  {
210  return collections_[std::make_pair(region, type)];
211 }
type
Definition: HCALResponse.h:21
RecoTauConstructor::SortedListPtr reco::tau::RecoTauConstructor::getSortedCollection ( Region  region,
ParticleType  type 
)
private

Definition at line 214 of file RecoTauConstructor.cc.

References sortedCollections_.

Referenced by addPFCand(), addTauChargedHadron(), and reserve().

214  {
215  return sortedCollections_[std::make_pair(region, type)];
216 }
type
Definition: HCALResponse.h:21
SortedCollectionMap sortedCollections_
const reco::Candidate::LorentzVector& reco::tau::RecoTauConstructor::p4 ( ) const
inline
void reco::tau::RecoTauConstructor::reserve ( Region  region,
ParticleType  type,
size_t  size 
)

Reserve a set amount of space for a given RefVector.

Definition at line 73 of file RecoTauConstructor.cc.

References getCollection(), getSortedCollection(), kAll, and findQualityFiles::size.

Referenced by reco::tau::RecoTauBuilderCombinatoricPlugin::operator()(), reservePiZero(), and setleadCand().

73  {
74  getSortedCollection(region, type)->reserve(size);
75  getCollection(region, type)->reserve(size);
76  // Reserve global collection as well
77  getSortedCollection(region, kAll)->reserve(
78  getSortedCollection(region, kAll)->size() + size);
79  getCollection(region, kAll)->reserve(
80  getCollection(region, kAll)->size() + size);
81 }
size
Write out results.
type
Definition: HCALResponse.h:21
std::vector< CandidatePtr > * getCollection(Region region, ParticleType type)
SortedListPtr getSortedCollection(Region region, ParticleType type)
void reco::tau::RecoTauConstructor::reservePiZero ( Region  region,
size_t  size 
)

Reserve a set amount of space for the PiZeros.

Definition at line 173 of file RecoTauConstructor.cc.

References copyGammas_, kGamma, kIsolation, kSignal, reserve(), and tau_.

Referenced by addTauChargedHadrons(), and reco::tau::RecoTauBuilderCombinatoricPlugin::operator()().

174 {
175  if ( region == kSignal ) {
176  tau_->signalPiZeroCandidatesRestricted().reserve(size);
177  // If we are building the gammas with the pizeros, resize that
178  // vector as well
179  if ( copyGammas_ ) reserve(kSignal, kGamma, 2*size);
180  } else {
181  tau_->isolationPiZeroCandidatesRestricted().reserve(size);
183  }
184 }
size
Write out results.
void reserve(Region region, ParticleType type, size_t size)
Reserve a set amount of space for a given RefVector.
std::auto_ptr< reco::PFTau > tau_
void reco::tau::RecoTauConstructor::reserveTauChargedHadron ( Region  region,
size_t  size 
)

Reserve a set amount of space for the ChargedHadrons.

Definition at line 83 of file RecoTauConstructor.cc.

References g4TestGeometry_cfi::checkOverlap(), edm::Ptr< T >::id(), edm::Ptr< T >::key(), kSignal, LogDebug, boostedElectronIsolation_cff::pfGamma, reco::tau::pfGammas(), edm::Ptr< T >::refCore(), and tau_.

Referenced by addPFCands().

84 {
85  if ( region == kSignal ) {
86  tau_->signalTauChargedHadronCandidatesRestricted().reserve(size);
87  tau_->selectedSignalChargedHadrCands_.reserve(size);
88  } else {
89  tau_->isolationTauChargedHadronCandidatesRestricted().reserve(size);
90  tau_->selectedIsolationChargedHadrCands_.reserve(size);
91  }
92 }
size
Write out results.
std::auto_ptr< reco::PFTau > tau_
template<typename T >
void reco::tau::RecoTauConstructor::setleadCand ( const T cand)
inline

Set leading PF candidate.

Definition at line 79 of file RecoTauConstructor.h.

References addPFCand(), convertToPtr(), reserve(), findQualityFiles::size, and tau_.

Referenced by reco::tau::RecoTauBuilderConePlugin::operator()().

79  {
80  tau_->setleadCand(convertToPtr(cand));
81  }
std::auto_ptr< reco::PFTau > tau_
CandidatePtr convertToPtr(const PFCandidatePtr &pfPtr) const
template<typename T >
void reco::tau::RecoTauConstructor::setleadChargedHadrCand ( const T cand)
inline

Set leading PFChargedHadron candidate.

Definition at line 69 of file RecoTauConstructor.h.

References convertToPtr(), and tau_.

Referenced by reco::tau::RecoTauBuilderConePlugin::operator()().

69  {
70  tau_->setleadChargedHadrCand(convertToPtr(cand));
71  }
std::auto_ptr< reco::PFTau > tau_
CandidatePtr convertToPtr(const PFCandidatePtr &pfPtr) const
template<typename T >
void reco::tau::RecoTauConstructor::setleadNeutralCand ( const T cand)
inline

Set leading PFGamma candidate.

Definition at line 74 of file RecoTauConstructor.h.

References convertToPtr(), and tau_.

Referenced by reco::tau::RecoTauBuilderConePlugin::operator()().

74  {
75  tau_->setleadNeutralCand(convertToPtr(cand));
76  }
std::auto_ptr< reco::PFTau > tau_
CandidatePtr convertToPtr(const PFCandidatePtr &pfPtr) const
void reco::tau::RecoTauConstructor::sortAndCopyIntoTau ( )
private

Definition at line 255 of file RecoTauConstructor.cc.

References collections_, reco::deltaR(), reco::PFTau::kNull, reco::PFTau::kOneProngNPiZero, reco::PFTau::kRareDecayMode, RecoTauCombinatoricProducer_cfi::maxPiZeros, RecoTauCombinatoricProducer_cfi::minAbsPhotonSumPt_insideSignalCone, RecoTauCombinatoricProducer_cfi::minAbsPhotonSumPt_outsideSignalCone, RecoTauCombinatoricProducer_cfi::minRelPhotonSumPt_insideSignalCone, RecoTauCombinatoricProducer_cfi::minRelPhotonSumPt_outsideSignalCone, hpstanc_transforms::nCharged, hpstanc_transforms::nPiZeros, reco::Candidate::p4(), reco::LeafCandidate::p4(), muons2muons_cfi::photon, reco::Candidate::pt(), reco::LeafCandidate::pt(), reco::PFTau::signalPiZeroCandidates(), reco::PFTau::signalTauChargedHadronCandidates(), jetUpdater_cfi::sort, sortedCollections_, metsig::tau, and tau_.

Referenced by get().

255  {
256  // The charged hadrons and pizeros are a special case, as we can sort them in situ
257  std::sort(tau_->signalTauChargedHadronCandidatesRestricted().begin(),
258  tau_->signalTauChargedHadronCandidatesRestricted().end(),
259  ptDescending<PFRecoTauChargedHadron>);
260  std::sort(tau_->isolationTauChargedHadronCandidatesRestricted().begin(),
261  tau_->isolationTauChargedHadronCandidatesRestricted().end(),
262  ptDescending<PFRecoTauChargedHadron>);
263  std::sort(tau_->signalPiZeroCandidatesRestricted().begin(),
264  tau_->signalPiZeroCandidatesRestricted().end(),
265  ptDescending<RecoTauPiZero>);
266  std::sort(tau_->isolationPiZeroCandidatesRestricted().begin(),
267  tau_->isolationPiZeroCandidatesRestricted().end(),
268  ptDescending<RecoTauPiZero>);
269 
270  // Sort each of our sortable collections, and copy them into the final
271  // tau RefVector.
272  for (auto const& colkey : collections_ ) {
273  SortedListPtr sortedCollection = sortedCollections_[colkey.first];
274  std::sort(sortedCollection->begin(),
275  sortedCollection->end(),
276  ptDescendingPtr<CandidatePtr>);
277  // Copy into the real tau collection
278  for ( std::vector<CandidatePtr>::const_iterator particle = sortedCollection->begin();
279  particle != sortedCollection->end(); ++particle ) {
280  colkey.second->push_back(*particle);
281  }
282  }
283 }
SortedCollectionMap sortedCollections_
boost::shared_ptr< std::vector< CandidatePtr > > SortedListPtr
std::auto_ptr< reco::PFTau > tau_

Member Data Documentation

CollectionMap reco::tau::RecoTauConstructor::collections_
private

Definition at line 159 of file RecoTauConstructor.h.

Referenced by getCollection(), RecoTauConstructor(), and sortAndCopyIntoTau().

bool reco::tau::RecoTauConstructor::copyGammas_
private
double reco::tau::RecoTauConstructor::minAbsPhotonSumPt_insideSignalCone_
private

Definition at line 141 of file RecoTauConstructor.h.

Referenced by get().

double reco::tau::RecoTauConstructor::minAbsPhotonSumPt_outsideSignalCone_
private

Definition at line 143 of file RecoTauConstructor.h.

Referenced by get().

double reco::tau::RecoTauConstructor::minRelPhotonSumPt_insideSignalCone_
private

Definition at line 142 of file RecoTauConstructor.h.

Referenced by get().

double reco::tau::RecoTauConstructor::minRelPhotonSumPt_outsideSignalCone_
private

Definition at line 144 of file RecoTauConstructor.h.

Referenced by get().

reco::Candidate::LorentzVector reco::tau::RecoTauConstructor::p4_
private

Definition at line 165 of file RecoTauConstructor.h.

Referenced by addPFCand(), addPiZero(), addTauChargedHadron(), get(), and p4().

const edm::Handle<edm::View<reco::Candidate> >& reco::tau::RecoTauConstructor::pfCands_
private

Definition at line 157 of file RecoTauConstructor.h.

Referenced by convertToPtr().

const StringObjectFunction<reco::PFTau>* reco::tau::RecoTauConstructor::signalConeSize_
private

Definition at line 140 of file RecoTauConstructor.h.

Referenced by get().

SortedCollectionMap reco::tau::RecoTauConstructor::sortedCollections_
private
std::auto_ptr<reco::PFTau> reco::tau::RecoTauConstructor::tau_
private