24 ldmx_log(debug) <<
"ECAL track collection does not exist";
29 const auto& ecal_tracks =
32 int n_tracks = ecal_tracks.size();
40 for (
size_t i_track = 0; i_track < ecal_tracks.size(); ++i_track) {
41 const auto& track = ecal_tracks[i_track];
44 double chi2 = track.getChi2();
45 int ndf = track.getNdf();
46 int nhits = track.getNhits();
57 double d0 = track.getD0();
58 double z0 = track.getZ0();
59 double phi = track.getPhi();
60 double theta = track.getTheta();
61 double qop = track.getQoP();
62 int charge = track.getCharge();
73 if (std::abs(qop) > 1e-9) {
74 p = 1.0 / std::abs(qop);
79 double px = p * std::sin(theta) * std::cos(phi);
80 double py = p * std::sin(theta) * std::sin(phi);
81 double pz = p * std::cos(theta);
83 double pt = std::sqrt(px * px + py * py);
91 double x = -d0 * std::sin(phi);
92 double y = d0 * std::cos(phi);
101 (ndf > 0) ? chi2 / ndf : 0.0);
112 for (
size_t j_track = i_track + 1; j_track < ecal_tracks.size();
114 const auto& other_track = ecal_tracks[j_track];
116 double phi1 = track.getPhi();
117 double theta1 = track.getTheta();
118 double phi2 = other_track.getPhi();
119 double theta2 = other_track.getTheta();
122 double dx1 = std::sin(theta1) * std::cos(phi1);
123 double dy1 = std::sin(theta1) * std::sin(phi1);
124 double dz1 = std::cos(theta1);
126 double dx2 = std::sin(theta2) * std::cos(phi2);
127 double dy2 = std::sin(theta2) * std::sin(phi2);
128 double dz2 = std::cos(theta2);
131 double dot = dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
132 double angle = std::acos(std::max(-1.0, std::min(1.0, dot)));
139 ldmx_log(debug) <<
"Analyzed " << n_tracks <<
" ECAL 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.