10 #include <boost/foreach.hpp>
11 #include <boost/bind.hpp>
12 #include <boost/iterator/filter_iterator.hpp>
44 candA->
p4() - candB->
p4();
45 return difference.P2();
51 template<
typename InputIterator>
53 InputIterator
begin, InputIterator
end) {
58 using boost::filter_iterator;
61 CandPtrBoolFn chargeMatcher =
65 typedef filter_iterator<CandPtrBoolFn, InputIterator> Iterator;
66 Iterator begin_filtered(chargeMatcher, begin, end);
67 Iterator end_filtered(chargeMatcher, end, end);
69 Iterator
result = std::min_element(begin_filtered, end_filtered,
84 return std::abs(tauRef->pt() - truth->pt());
87 typedef std::set<CandPtr> CandPtrSet;
88 typedef std::vector<CandPtr> CandPtrVector;
89 typedef std::list<CandPtr> CandPtrList;
91 CandPtrList recoCands;
92 CandPtrSet truthCandSet;
95 tauRef->signalPiZeroCandidates()) {
96 recoCands.push_back(&piZero);
100 tauRef->signalPFChargedHadrCands()) {
101 recoCands.push_back(pfch.
get());
107 truth->daughterPtrVector()) {
109 if (ptr->pdgId() == 22)
110 truthCandSet.insert(ptr->mother());
112 truthCandSet.insert(ptr.
get());
116 CandPtrVector truthCands(truthCandSet.begin(), truthCandSet.end());
119 std::sort(truthCands.begin(), truthCands.end(),
122 double quality = 0.0;
123 BOOST_FOREACH(CandPtr truthCand, truthCands) {
125 CandPtrList::iterator recoMatch = findBestMatch(truthCand,
126 recoCands.begin(), recoCands.end());
129 if (recoMatch != recoCands.end()) {
132 quality += momentumDifference(truthCand, *recoMatch);
134 recoCands.erase(recoMatch);
137 quality += truthCand->p4().P2();
142 BOOST_FOREACH(CandPtr recoCand, recoCands) {
143 quality += recoCand->p4().P2();
T getParameter(std::string const &) const
virtual double pt() const =0
transverse momentum
bool isNull() const
Checks for null.
T const * get() const
Returns C++ pointer to the item.
helper::RootFunctionHelper< F, args >::root_function function(F &f)
virtual int charge() const =0
electric charge
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const edm::Event * evt() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
#define DEFINE_EDM_PLUGIN(factory, type, name)
T const * get() const
Returns C++ pointer to the item.
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector