122{
123
124 float bestChi2 = chi2Cut;
125 float chi2_best = chi2Cut;
126 float chi2Eta_best = chi2Cut;
127 float chi2Phi_best = chi2Cut;
128 float chi2_best_4 = chi2Cut;
129 float chi2Eta_best_4 = chi2Cut;
130 float chi2Phi_best_4 = chi2Cut;
131 float chi2_best_5 = chi2Cut;
132 float chi2Eta_best_5 = chi2Cut;
133 float chi2Phi_best_5 = chi2Cut;
134
135
136 auto monitorChi2 = [&](
const std::string& chi2_name,
float chi2_value,
float& best_value,
const std::string&
suffix=
"") {
137 if (chi2_value < chi2Cut) {
138
139 auto mon = Monitored::Scalar<float>(chi2_name + suffix, chi2_value);
141
142 if (chi2_value < best_value) best_value = chi2_value;
143 }
144 };
145
146
147
148 auto mon_nTracks = Monitored::Scalar<int>("nTracks", tracks.size());
149
150 Monitored::Group(
m_monTool, mon_nTracks);
151
152
154
155
156 for (const auto& track : tracks) {
157
158 int nValidHits = 0;
159 for (
const auto& hit :
track->getFPGATrackSimHits()) {
160 if (hit.isReal()) {
161 ++nValidHits;
162 }
163 }
164 auto mon_nHits = Monitored::Scalar<int>("nHits", nValidHits);
166
167
168 float chi2_all =
track->getChi2ndof();
169 if (chi2_all < chi2Cut) {
170 auto mon_chi2_all = Monitored::Scalar<float>("chi2_all", chi2_all);
171 Monitored::Group(
m_monTool, mon_chi2_all);
172
173 if (chi2_all < bestChi2) {
174 bestChi2 = chi2_all;
175 }
176 }
177
178
179 monitorChi2(
"chi2",
track->getChi2(), chi2_best);
180 monitorChi2(
"chi2Eta",
track->getChi2Eta(), chi2Eta_best);
181 monitorChi2(
"chi2Phi",
track->getChi2Phi(), chi2Phi_best);
182
183
184 if (nValidHits == 4) {
185 monitorChi2(
"chi2",
track->getChi2(), chi2_best_4,
"_4");
186 monitorChi2(
"chi2Eta",
track->getChi2Eta(), chi2Eta_best_4,
"_4");
187 monitorChi2(
"chi2Phi",
track->getChi2Phi(), chi2Phi_best_4,
"_4");
188 } else if (nValidHits == 5) {
189 monitorChi2(
"chi2",
track->getChi2(), chi2_best_5,
"_5");
190 monitorChi2(
"chi2Eta",
track->getChi2Eta(), chi2Eta_best_5,
"_5");
191 monitorChi2(
"chi2Phi",
track->getChi2Phi(), chi2Phi_best_5,
"_5");
192 }
193 }
194
195 if (bestChi2 < chi2Cut) {
196 auto mon_best_chi2 = Monitored::Scalar<float>("best_chi2", bestChi2);
197 Monitored::Group(
m_monTool, mon_best_chi2);
198 }
199
200
201 auto monitorBestChi2 = [&](const std::string& best_name, float best_value) {
202 if (best_value < chi2Cut) {
203 auto mon_best = Monitored::Scalar<float>(best_name, best_value);
205 }
206 };
207
208
209 monitorBestChi2("chi2_best", chi2_best);
210 monitorBestChi2("chi2Eta_best", chi2Eta_best);
211 monitorBestChi2("chi2Phi_best", chi2Phi_best);
212 monitorBestChi2("chi2_best_4", chi2_best_4);
213 monitorBestChi2("chi2Eta_best_4", chi2Eta_best_4);
214 monitorBestChi2("chi2Phi_best_4", chi2Phi_best_4);
215 monitorBestChi2("chi2_best_5", chi2_best_5);
216 monitorBestChi2("chi2Eta_best_5", chi2Eta_best_5);
217 monitorBestChi2("chi2Phi_best_5", chi2Phi_best_5);
218
219
220
221 if (truthTracks.size() > 0) {
222
224
226
227 const auto& truthTrack = truthTracks.front();
228
229 auto mon_eff = Monitored::Scalar<bool>("eff_track", (tracks.size() > 0));
230 auto mon_truth_pt_zoom = Monitored::Scalar<float>("pT_zoom", truthTrack.getPt()*0.001);
231 auto mon_truth_pt = Monitored::Scalar<float>("pT", truthTrack.getPt()*0.001f);
232 auto mon_truth_eta = Monitored::Scalar<float>("eta", truthTrack.getEta());
233 auto mon_truth_phi = Monitored::Scalar<float>("phi", truthTrack.getPhi());
234 auto mon_truth_d0 = Monitored::Scalar<float>("d0", truthTrack.getD0());
235 auto mon_truth_z0 = Monitored::Scalar<float>("z0", truthTrack.getZ0());
236 Monitored::Group(
m_monTool, mon_eff, mon_truth_pt_zoom, mon_truth_pt, mon_truth_eta, mon_truth_phi, mon_truth_d0, mon_truth_z0 );
237 }
238}