3 #include <boost/foreach.hpp>
4 #include <boost/bind.hpp>
12 bool copyGammasFromPiZeros):pfCands_(pfCands) {
20 &
tau_->selectedSignalPFChargedHadrCands_;
22 &
tau_->selectedSignalPFGammaCands_;
24 &
tau_->selectedSignalPFNeutrHadrCands_;
26 &
tau_->selectedSignalPFCands_;
29 &
tau_->selectedIsolationPFChargedHadrCands_;
31 &
tau_->selectedIsolationPFGammaCands_;
33 &
tau_->selectedIsolationPFNeutrHadrCands_;
35 &
tau_->selectedIsolationPFCands_;
42 new SortedListPtr::element_type);
73 tau_->signalPiZeroCandidates_.reserve(size);
79 tau_->isolationPiZeroCandidates_.reserve(size);
87 tau_->signalPiZeroCandidates_.push_back(piZero);
97 tau_->isolationPiZeroCandidates_.push_back(piZero);
123 template<
typename T1,
typename T2>
124 void checkMatchedProductIds(
const T1& t1,
const T2& t2) {
125 if (t1.id() != t2.id()) {
126 throw cms::Exception(
"MismatchedPFCandSrc") <<
"Error: the input tag"
127 <<
" for the PF candidate collection provided to the RecoTauBuilder "
128 <<
" does not match the one that was used to build the source jets."
129 <<
" Please update the pfCandSrc paramters for the PFTau builders.";
138 checkMatchedProductIds(pfPtr,
pfCands_);
147 checkMatchedProductIds(candPtr,
pfCands_);
153 template<
typename T>
bool ptDescending(
const T&
a,
const T&
b) {
154 return a.pt() > b.pt();
156 template<
typename T>
bool ptDescendingRef(
const T& a,
const T& b) {
157 return a->pt() > b->pt();
164 tau_->signalPiZeroCandidates_.end(),
165 ptDescending<RecoTauPiZero>);
167 tau_->isolationPiZeroCandidates_.end(),
168 ptDescending<RecoTauPiZero>);
175 sortedCollection->end(),
176 ptDescendingRef<PFCandidateRef>);
179 sortedCollection->begin(), sortedCollection->end(),
195 tau_->setPdgId(
tau_->charge() < 0 ? 15 : -15);
207 tau_->setisolationPFChargedHadrCandsPtSum(
215 tau_->setisolationPFGammaCandsEtSum(
226 if(setupLeadingObjects)
236 tau_->setleadPFCand(*leadingCand);
245 tau_->setleadPFChargedHadrCand(*leadingChargedCand);
254 tau_->setleadPFNeutralCand(*leadingGammaCand);
reco::Candidate::LorentzVector p4_
std::auto_ptr< reco::PFTau > get(bool setupLeadingCandidates=true)
CollectionMap collections_
void reserve(Region region, ParticleType type, size_t size)
Reserve a set amount of space for a given RefVector.
double sumPFCandPt(InputIterator begin, InputIterator end)
Sum the PT of a collection of PFCandidates.
void addPFCand(Region region, ParticleType type, const PFCandidateRef &ref)
Append a PFCandidateRef to a given collection.
SortedCollectionMap sortedCollections_
bool isNonnull() const
Checks for non-null.
const edm::Handle< PFCandidateCollection > & pfCands_
PFCandidateRef convertToRef(const PFCandidatePtr &pfPtr) const
SortedListPtr getSortedCollection(Region region, ParticleType type)
edm::Ref< PFCandidateCollection > PFCandidateRef
persistent reference to a PFCandidate
void reserve(size_type n)
Reserve space for RefVector.
Container::value_type value_type
void addPFCands(Region region, ParticleType type, const InputIterator &begin, const InputIterator &end)
InputIterator leadPFCand(InputIterator begin, InputIterator end)
boost::shared_ptr< std::vector< PFCandidateRef > > SortedListPtr
PFCandidateRefVector * getCollection(Region region, ParticleType type)
std::auto_ptr< reco::PFTau > tau_
void reservePiZero(Region region, size_t size)
Reserve a set amount of space for the PiZeros.
RecoTauConstructor(const PFJetRef &jetRef, const edm::Handle< PFCandidateCollection > &pfCands, bool copyGammasFromPiZeros=false)
Constructor with PFCandidate Handle.
const daughters & daughterPtrVector() const
references to daughtes
void sortAndCopyIntoTau()
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
void addPiZero(Region region, const RecoTauPiZero &piZero)
Add a PiZero to the given collection.
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
tuple size
Write out results.
int sumPFCandCharge(InputIterator begin, InputIterator end)
Sum the PT of a collection of PFCandidates.