19 return sqrt(pow(pxyz[0], 2) + pow(pxyz[1], 2) + pow(pxyz[2], 2));
23 if (!event.
exists(input_track_coll_name_, input_pass_name_)) {
24 ldmx_log(fatal) <<
"Couldn't find input collection "
25 << input_track_coll_name_ <<
"_" << input_pass_name_;
29 input_track_coll_name_, input_pass_name_);
31 std::vector<ldmx::SimTrackerHit> pf_tracks;
32 if (truth_tracking_) {
33 for (
const auto& sp_hit : ecal_sp_hits) {
34 if (sp_hit.getPdgID() == 22 || sp_hit.getPdgID() == 2112)
continue;
35 if (fabs(240 - sp_hit.getPosition()[2]) > 0.1)
continue;
36 if (do_electron_tracking_) {
37 if (sp_hit.getPdgID() != 11)
continue;
38 if (sp_hit.getTrackID() < 2 &&
39 sp_hit.getMomentum()[2] > min_electron_momentum_z_) {
41 pf_tracks.push_back(sp_hit);
42 ldmx_log(debug) <<
"Added beam electron SP hit: trackID="
43 << sp_hit.getTrackID()
44 <<
", pz = " << sp_hit.getMomentum()[2];
45 }
else if (sp_hit.getTrackID() <= max_electron_track_id_ &&
46 sp_hit.getMomentum()[2] > 5) {
49 pf_tracks.push_back(sp_hit);
50 ldmx_log(debug) <<
"Adding SP hit: trackID=" << sp_hit.getTrackID()
51 <<
", pdgID= " << sp_hit.getPdgID()
52 <<
", pz = " << sp_hit.getMomentum()[2];
57 if (sp_hit.getTrackID() != 1 ||
58 fabs(240 - sp_hit.getPosition()[2]) > 0.1 ||
59 sp_hit.getMomentum()[2] < 0)
61 pf_tracks.push_back(sp_hit);
62 ldmx_log(debug) <<
"Adding SP hit: trackID=" << sp_hit.getTrackID()
63 <<
", pdgID= " << sp_hit.getPdgID()
64 <<
", pz = " << sp_hit.getMomentum()[2];
69 std::sort(pf_tracks.begin(), pf_tracks.end(),
71 return getP(a) > getP(b);
73 event.add(output_track_coll_name_, pf_tracks);
bool exists(const std::string &name, const std::string &passName, bool unique=true) const
Check for the existence of an object or collection with the given name and pass name in the event.