30 return StatusCode::SUCCESS;
37 m_tree =
new TTree(
"FPGATrackSimHoughRootOutput",
"FPGATrackSimHoughRootOutput");
82 m_truthtree =
new TTree(
"FPGATrackSimTruthTree",
"FPGATrackSimTruthTree");
109 m_offlinetree =
new TTree(
"FPGATrackSimOfflineTree",
"FPGATrackSimOfflineTree");
131 return StatusCode::SUCCESS;
136 StatusCode FPGATrackSimHoughRootOutputTool::fillTree(
const std::vector<std::shared_ptr<const FPGATrackSimRoad>> &roads,
const std::vector<FPGATrackSimTruthTrack> &truthTracks,
const std::vector<FPGATrackSimOfflineTrack> &offlineTracks,
const std::vector<std::shared_ptr<const FPGATrackSimHit>> &hits_2nd,
const bool writeOutNonSPStripHits,
const float minChi2,
const int maxOverlappingHits)
144 std::vector<float> tmp_hits_x;
145 std::vector<float> tmp_hits_y;
146 std::vector<float> tmp_hits_z;
147 std::vector<float> tmp_hits_R;
148 std::vector<float> tmp_hits_phi;
149 std::vector<int> tmp_hits_layer_disk;
150 std::vector<bool> tmp_hits_mapped;
151 std::vector<bool> tmp_hits_isPixel;
152 std::vector<bool> tmp_hits_isStrip;
153 std::vector<bool> tmp_hits_isClustered;
154 std::vector<bool> tmp_hits_isSpacepoint;
155 std::vector<float> tmp_hits_barcodefrac;
156 std::vector<int> tmp_hits_barcode;
157 std::vector<float> tmp_hits_zIdeal;
158 std::vector<float> tmp_hits_gphiIdeal;
159 std::vector<long> tmp_hits_fineID;
161 std::vector<float> tmp_hits_x_sorted;
162 std::vector<float> tmp_hits_y_sorted;
163 std::vector<float> tmp_hits_z_sorted;
164 std::vector<float> tmp_hits_R_sorted;
165 std::vector<float> tmp_hits_phi_sorted;
166 std::vector<int> tmp_hits_layer_disk_sorted;
167 std::vector<bool> tmp_hits_isPixel_sorted;
168 std::vector<bool> tmp_hits_isStrip_sorted;
169 std::vector<bool> tmp_hits_isClustered_sorted;
170 std::vector<bool> tmp_hits_isSpacepoint_sorted;
171 std::vector<float> tmp_hits_barcodefrac_sorted;
172 std::vector<int> tmp_hits_barcode_sorted;
173 std::vector<float> tmp_hits_zIdeal_sorted;
174 std::vector<float> tmp_hits_gphiIdeal_sorted;
175 std::vector<long> tmp_hits_fineID_sorted;
177 std::vector<bool> tmp_hits_mapped_sorted;
178 bool has_strip_nonspacepoint;
183 for (
const auto &
track : truthTracks) {
185 if (
track.getStatus() != 1)
continue;
192 tmp_hits_phi.clear();
193 tmp_hits_layer_disk.clear();
194 tmp_hits_mapped.clear();
195 tmp_hits_isPixel.clear();
196 tmp_hits_isStrip.clear();
197 tmp_hits_isClustered.clear();
198 tmp_hits_isSpacepoint.clear();
199 tmp_hits_barcodefrac.clear();
200 tmp_hits_barcode.clear();
201 tmp_hits_zIdeal.clear();
202 tmp_hits_gphiIdeal.clear();
203 tmp_hits_fineID.clear();
205 tmp_hits_x_sorted.clear();
206 tmp_hits_y_sorted.clear();
207 tmp_hits_z_sorted.clear();
208 tmp_hits_R_sorted.clear();
209 tmp_hits_phi_sorted.clear();
210 tmp_hits_layer_disk_sorted.clear();
211 tmp_hits_isPixel_sorted.clear();
212 tmp_hits_isStrip_sorted.clear();
213 tmp_hits_isClustered_sorted.clear();
214 tmp_hits_isSpacepoint_sorted.clear();
215 tmp_hits_barcodefrac_sorted.clear();
216 tmp_hits_barcode_sorted.clear();
217 tmp_hits_zIdeal_sorted.clear();
218 tmp_hits_gphiIdeal_sorted.clear();
219 tmp_hits_fineID_sorted.clear();
221 has_strip_nonspacepoint =
false;
224 std::vector<float> idealized_coords;
229 for (
auto hit : hits_2nd) {
231 if (hit->getBarcode() ==
track.getBarcode()) {
233 if (hit->isPixel() == 0 && hit->getHitType() !=
HitType::spacepoint) {has_strip_nonspacepoint =
true;}
238 const bool ok = truth.
best(tbarcode, tfrac);
239 if (tfrac < 1.0) {
continue; }
241 tmp_hits_barcode.push_back((
int)(tbarcode.second));
242 tmp_hits_barcodefrac.push_back(tfrac);
245 tmp_hits_barcode.push_back(-1);
246 tmp_hits_barcodefrac.push_back(-1);
249 tmp_hits_x.push_back(hit->getX());
250 tmp_hits_y.push_back(hit->getY());
251 tmp_hits_z.push_back(hit->getZ());
252 tmp_hits_R.push_back(hit->getR());
253 tmp_hits_phi.push_back(hit->getGPhi());
254 tmp_hits_layer_disk.push_back(hit->getLayerDisk());
255 tmp_hits_mapped.push_back(hit->isMapped());
256 tmp_hits_isPixel.push_back(hit->isPixel());
257 tmp_hits_isStrip.push_back(hit->isStrip());
258 tmp_hits_isClustered.push_back(hit->isClustered());
260 tmp_hits_fineID.push_back(
getFineID(*hit));
264 tmp_hits_zIdeal.push_back(idealized_coords[0]);
265 tmp_hits_gphiIdeal.push_back(idealized_coords[1]);
268 tmp_hits_isSpacepoint.push_back(
true);
271 tmp_hits_isSpacepoint.push_back(
false);
279 if ( (! writeOutNonSPStripHits & has_strip_nonspacepoint)) {
280 ATH_MSG_DEBUG(
"Truth Track is not written to HoughRootOutput file, because it contains a non-SP strip hit!");
284 std::vector<int> sorting_index(tmp_hits_R.size(), 0);
285 for (
unsigned int i = 0 ;
i != sorting_index.size() ;
i++) {
286 sorting_index[
i] =
i;
288 sort(sorting_index.begin(), sorting_index.end(),
289 [&](
const int&
a,
const int&
b) {
290 return (tmp_hits_R[a] < tmp_hits_R[b]);
294 for (
unsigned int i = 0 ;
i != sorting_index.size() ;
i++) {
295 tmp_hits_x_sorted.push_back(tmp_hits_x[sorting_index[
i]]);
296 tmp_hits_y_sorted.push_back(tmp_hits_y[sorting_index[
i]]);
297 tmp_hits_z_sorted.push_back(tmp_hits_z[sorting_index[
i]]);
298 tmp_hits_R_sorted.push_back(tmp_hits_R[sorting_index[
i]]);
299 tmp_hits_phi_sorted.push_back(tmp_hits_phi[sorting_index[
i]]);
300 tmp_hits_layer_disk_sorted.push_back(tmp_hits_layer_disk[sorting_index[
i]]);
301 tmp_hits_isPixel_sorted.push_back(tmp_hits_isPixel[sorting_index[
i]]);
302 tmp_hits_isStrip_sorted.push_back(tmp_hits_isStrip[sorting_index[
i]]);
303 tmp_hits_isClustered_sorted.push_back(tmp_hits_isClustered[sorting_index[
i]]);
304 tmp_hits_isSpacepoint_sorted.push_back(tmp_hits_isSpacepoint[sorting_index[
i]]);
305 tmp_hits_barcode_sorted.push_back(tmp_hits_barcode[sorting_index[
i]]);
306 tmp_hits_barcodefrac_sorted.push_back(tmp_hits_barcodefrac[sorting_index[
i]]);
307 tmp_hits_zIdeal_sorted.push_back(tmp_hits_zIdeal[sorting_index[
i]]);
308 tmp_hits_gphiIdeal_sorted.push_back(tmp_hits_gphiIdeal[sorting_index[
i]]);
309 tmp_hits_fineID_sorted.push_back(tmp_hits_fineID[sorting_index[
i]]);
346 for (
auto track : offlineTracks) {
358 int nhole(0), nmeasurement(0), ninert(0), nbrem(0), nscatter(0), nperigee(0), noutlier(0), nother(0);
359 for (
const auto& hit :
track.getOfflineHits()) {
382 std::vector<FPGATrackSimMultiTruth> mtv;
387 std::vector<FPGATrackSimTrack> track_cands;
390 for (
size_t iroad = 0; iroad < roads.size(); iroad++) {
392 std::shared_ptr<const FPGATrackSimRoad> road = roads[iroad];
393 std::vector<FPGATrackSimTrack> track_cand;
394 if (road ==
nullptr)
continue;
426 for (
auto const &tr : track_cand) {
427 track_cands.push_back(tr);
433 for (
auto const &cand : track_cands) {
434 if (cand.passedOR()) {
443 for (
size_t iroad = 0; iroad < track_cands.size(); iroad++) {
447 m_roadChi2.push_back(track_cands[iroad].getChi2ndof());
468 mtv.push_back( truth );
472 const bool ok = truth.
best(tbarcode,tfrac);
475 m_barcode.push_back((
int)(tbarcode.second));
485 std::shared_ptr<const FPGATrackSimHit> hit_ptr = std::make_shared<const FPGATrackSimHit>(hit);
488 m_x.push_back(hit.getX());
489 m_y.push_back(hit.getY());
490 m_z.push_back(hit.getZ());
494 m_etaID.push_back(hit.getEtaModule());
496 m_gphi.push_back(hit.getGPhi());
497 m_zIdeal.push_back(idealized_coords[0]);
499 m_isPixel.push_back(hit.isPixel() ? 1 : 0);
500 m_layer.push_back(hit.getLayer());
506 m_ID.push_back(hit.getIdentifierHash());
516 const bool ok = mt.
best(tbarcode,tfrac);
536 return StatusCode::SUCCESS;