1 #ifndef RecoTauTag_RecoTau_RecoTauCommonUtilities_h 2 #define RecoTauTag_RecoTau_RecoTauCommonUtilities_h 24 #include <boost/iterator/transform_iterator.hpp> 25 #include <boost/iterator/indirect_iterator.hpp> 26 #include <boost/mem_fn.hpp> 28 #include <boost/type_traits/is_base_of.hpp> 40 template <
typename Iterator>
45 std::vector<CandidatePtr>
output;
49 output.push_back(ptr);
61 std::vector<CandidatePtr>
pfCandidates(
const Jet& jet,
const std::vector<int>& particleIds,
bool sort =
true);
74 std::vector<CandidatePtr>
pfGammas(
const Jet& jet,
bool sort =
true);
77 std::vector<CandidatePtr>
flattenPiZeros(
const std::vector<RecoTauPiZero>::const_iterator&,
78 const std::vector<RecoTauPiZero>::const_iterator&);
79 std::vector<CandidatePtr>
flattenPiZeros(
const std::vector<RecoTauPiZero>&);
82 template <
typename RefVectorType,
typename BaseView>
89 size_t nElements = view->size();
90 output.reserve(nElements);
92 for (
size_t i = 0;
i < nElements; ++
i) {
93 output.push_back(view->refAt(
i).template castTo<OutputRef>());
103 template <
typename InputIterator>
105 size_t input_size = end -
begin;
106 return (N > input_size) ? end : begin +
N;
110 template <
typename InputIterator,
typename FunctionPtr,
typename ReturnType>
115 output += ((**cand).*(
func))();
120 template <
typename InputIterator>
126 template <
typename InputIterator>
132 template <
typename InputIterator>
137 template <
typename InputIterator>
140 InputIterator max_cand =
begin;
142 if ((*cand)->pt() > max_pt) {
143 max_pt = (*cand)->pt();
std::vector< CandidatePtr > pfCandidatesByPdgId(const Jet &jet, int pdgId, bool sort=true)
std::vector< CandidatePtr > pfCandidates(const Jet &jet, int particleId, bool sort=true)
InputIterator takeNElements(const InputIterator &begin, const InputIterator &end, size_t N)
math::XYZPointF atECALEntrance(const reco::Candidate *part, double bField)
double sumPFCandPt(InputIterator begin, InputIterator end)
Sum the pT of a collection of PFCandidates.
reco::Candidate::LorentzVector sumPFCandP4(InputIterator begin, InputIterator end)
RefVectorType castView(const edm::Handle< BaseView > &view)
Convert a BaseView (View<T>) to a TRefVector.
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
std::vector< CandidatePtr > pfChargedCands(const Jet &jet, bool sort=true)
Extract all non-neutral candidates from a PFJet.
ReturnType sumPFVector(InputIterator begin, InputIterator end, FunctionPtr func, ReturnType init)
Sum the four vectors in a collection of PFCandidates.
InputIterator leadCand(InputIterator begin, InputIterator end)
std::vector< CandidatePtr > 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.
bool operator()(const CandidatePtr &a, const CandidatePtr &b) const
Container::value_type value_type
std::map< DetId, double > ReturnType
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
Abs< T >::type abs(const T &t)
virtual double pt() const =0
transverse momentum
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual int charge() const =0
electric charge
int sumPFCandCharge(InputIterator begin, InputIterator end)
Sum the charge of a collection of PFCandidates.
std::vector< CandidatePtr > filterPFCandidates(const Iterator &begin, const Iterator &end, int pdgId, bool sort=true)
std::vector< CandidatePtr > pfGammas(const Jet &jet, bool sort=true)
Extract all pfGammas from a PFJet.