22 ldmx_log(debug) <<
"ECAL track collection does not exist";
27 const auto& ecal_tracks =
30 int n_tracks = ecal_tracks.size();
38 for (
size_t i_track = 0; i_track < ecal_tracks.size(); ++i_track) {
39 const auto& track = ecal_tracks[i_track];
42 double chi2 = track.getChi2();
43 int ndf = track.getNdf();
44 int nhits = track.getNhits();
55 double d0 = track.getD0();
56 double z0 = track.getZ0();
57 double phi = track.getPhi();
58 double theta = track.getTheta();
59 double qop = track.getQoP();
60 int charge = track.getCharge();
71 if (std::abs(qop) > 1e-9) {
72 p = 1.0 / std::abs(qop);
77 double px = p * std::sin(theta) * std::cos(phi);
78 double py = p * std::sin(theta) * std::sin(phi);
79 double pz = p * std::cos(theta);
81 double pt = std::sqrt(px * px + py * py);
89 double x = -d0 * std::sin(phi);
90 double y = d0 * std::cos(phi);
98 histograms_.
fill(
"track_nhits_vs_chi2_ndf", nhits, (ndf > 0) ? chi2 / ndf : 0.0);
109 for (
size_t j_track = i_track + 1; j_track < ecal_tracks.size();
111 const auto& other_track = ecal_tracks[j_track];
113 double phi1 = track.getPhi();
114 double theta1 = track.getTheta();
115 double phi2 = other_track.getPhi();
116 double theta2 = other_track.getTheta();
119 double dx1 = std::sin(theta1) * std::cos(phi1);
120 double dy1 = std::sin(theta1) * std::sin(phi1);
121 double dz1 = std::cos(theta1);
123 double dx2 = std::sin(theta2) * std::cos(phi2);
124 double dy2 = std::sin(theta2) * std::sin(phi2);
125 double dz2 = std::cos(theta2);
128 double dot = dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
129 double angle = std::acos(std::max(-1.0, std::min(1.0, dot)));
136 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.