LDMX Software
PFCandidate.cxx
2
3// STL
4#include <algorithm>
5#include <iostream>
6
7ClassImp(ldmx::PFCandidate);
8
9namespace ldmx {
10void PFCandidate::addHits(std::vector<unsigned int>& ids,
11 std::vector<float>& es,
12 const std::vector<unsigned int>& new_ids,
13 const std::vector<float>& new_es) {
14 for (size_t k = 0; k < new_ids.size(); k++) {
15 float e = k < new_es.size() ? new_es[k] : 0.f;
16 auto it = std::find(ids.begin(), ids.end(), new_ids[k]);
17 if (it == ids.end()) {
18 ids.push_back(new_ids[k]);
19 es.push_back(e);
20 } else {
21 es[it - ids.begin()] += e;
22 }
23 }
24}
25
26std::ostream& operator<<(std::ostream& o, const PFCandidate& c) {
27 return o << "PFCandidate ( " << "id: " << c.pid_ << ", pdg: " << c.pdg_id_
28 << "), " << "Pxyz: (" << c.track_px_ << ", " << c.track_py_ << ", "
29 << c.track_pz_ << ") MeV/c, " << "Ecal energy: " << c.ecal_energy_
30 << " MeV, "
31 << "Hcal energy: " << c.hcal_energy_ << " MeV, ";
32}
33} // namespace ldmx
Class that represents a reconstructed particle candidate.
Represents a reconstructed particle.
Definition PFCandidate.h:21