20 return sqrt(pow(pxyz[0], 2) + pow(pxyz[1], 2) + pow(pxyz[2], 2));
24 if (!event.
exists(input_track_coll_name_, input_pass_name_)) {
25 ldmx_log(fatal) <<
"Couldn't find input collection "
26 << input_track_coll_name_ <<
"_" << input_pass_name_;
30 input_track_coll_name_, input_pass_name_);
32 std::vector<ldmx::SimTrackerHit> pf_tracks;
33 if (truth_tracking_) {
34 for (
const auto& sp_hit : ecal_sp_hits) {
35 if (sp_hit.getPdgID() == 22 || sp_hit.getPdgID() == 2112)
continue;
36 if (fabs(240 - sp_hit.getPosition()[2]) > 0.1)
continue;
37 if (do_electron_tracking_) {
38 if (sp_hit.getPdgID() != 11)
continue;
39 if (sp_hit.getTrackID() < 2 &&
40 sp_hit.getMomentum()[2] > min_electron_momentum_z_) {
42 pf_tracks.push_back(sp_hit);
43 ldmx_log(debug) <<
"Added beam electron SP hit: trackID="
44 << sp_hit.getTrackID()
45 <<
", pz = " << sp_hit.getMomentum()[2];
46 }
else if (sp_hit.getTrackID() <= max_electron_track_id_ &&
47 sp_hit.getMomentum()[2] > 5) {
50 pf_tracks.push_back(sp_hit);
51 ldmx_log(debug) <<
"Adding SP hit: trackID=" << sp_hit.getTrackID()
52 <<
", pdgID= " << sp_hit.getPdgID()
53 <<
", pz = " << sp_hit.getMomentum()[2];
58 if (sp_hit.getTrackID() != 1 ||
59 fabs(240 - sp_hit.getPosition()[2]) > 0.1 ||
60 sp_hit.getMomentum()[2] < 0)
62 pf_tracks.push_back(sp_hit);
63 ldmx_log(debug) <<
"Adding SP hit: trackID=" << sp_hit.getTrackID()
64 <<
", pdgID= " << sp_hit.getPdgID()
65 <<
", pz = " << sp_hit.getMomentum()[2];
70 std::sort(pf_tracks.begin(), pf_tracks.end(),
72 return getP(a) > getP(b);
74 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.