1 #include "../interface/CompositeCandidate.hh"
5 #include "Math/VectorUtil.h"
14 cand_map_[name] = cand;
15 cand_vec_.push_back(cand);
22 return cand_map_.find(name)->second;
29 return cand_vec_.at(index);
36 return cand_map_.find(name)->second->pt();
42 for (
unsigned i = 0; i < cand_vec_.size(); ++i) {
43 pt_sum += cand_vec_[i]->pt();
49 if (!Verify(name1) || !Verify(name2)) {
52 return ROOT::Math::VectorUtil::DeltaR(
53 (cand_map_.find(name1)->second->vector()),
54 (cand_map_.find(name2)->second->vector()));
59 std::string name2)
const {
60 if (!Verify(name1) || !Verify(name2)) {
63 return ROOT::Math::VectorUtil::DeltaPhi(
64 (cand_map_.find(name1)->second->vector()),
65 (cand_map_.find(name2)->second->vector()));
70 std::cout <<
"CompositeCandidate: " <<
vector() << std::endl;
71 std::map<std::string, Candidate*>::const_iterator iter;
72 for (iter = cand_map_.begin(); iter != cand_map_.end(); ++iter) {
73 std::cout << iter->first <<
"\t" << iter->second->vector() << std::endl;
77 bool CompositeCandidate::Verify(std::string
const& name)
const {
78 static std::set<std::string> warned;
79 if (!cand_map_.count(name)) {
80 if (!warned.count(name)) {
82 std::cerr <<
"Warning in CompositeCandidate: Candidate with label \""
83 << name <<
"\" not found" << std::endl;
Candidate * GetCandidate(std::string name) const
double DeltaR(std::string name1, std::string name2) const
virtual void Print() const
double ScalarPtSum() const
double DeltaPhi(std::string name1, std::string name2) const
int charge() const
Electric charge.
void set_vector(Vector const &vector)
Four-momentum.
Stores a four-momentum, charge and identifier, and is the base class for most other physics objects...
Vector const & vector() const
Four-momentum.
Candidate * At(unsigned index) const
void set_charge(int const &charge)
Electric charge.
double PtOf(std::string name) const
void AddCandidate(std::string name, Candidate *cand)
Add a new Candidate.
virtual ~CompositeCandidate()