ATLAS Offline Software
FPGATrackSimMatrixGenAlgo.cxx
Go to the documentation of this file.
1 // Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
11 #include "GaudiKernel/MsgStream.h"
12 #include "GaudiKernel/ITHistSvc.h"
19 
20 #include "TH1.h"
21 #include "TH2.h"
22 #include "TStyle.h"
23 
24 #include <cassert>
25 #include <sstream>
26 #include <iostream>
27 #include <fstream>
28 #include <cmath>
29 #include <utility>
30 
31 
33 // Constructors
35 
36 FPGATrackSimMatrixGenAlgo::FPGATrackSimMatrixGenAlgo(const std::string& name, ISvcLocator* pSvcLocator) :
37  AthAlgorithm(name, pSvcLocator)
38 {
39 }
40 
41 
42 
44 // Initialize
46 
48 {
49  ATH_MSG_DEBUG("initialize()");
50 
51  // set the slicing variables from inputs
57 
63 
69 
70  // Retrieve handles
71  ATH_CHECK(m_tHistSvc.retrieve());
72  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
73  ATH_CHECK(m_hitInputTool.retrieve());
74  ATH_CHECK(m_hitMapTool.retrieve());
75  ATH_CHECK(m_EvtSel.retrieve());
76  ATH_CHECK(m_roadFinderTool.retrieve());
77  if (m_doClustering) ATH_CHECK(m_clusteringTool.retrieve());
79 
80  if (m_doHoughConstants) {
81  if (m_ideal_geom == 0) {
82  ATH_MSG_INFO("Hough constants method needs idealized geometry > 0, aborting.");
83  return StatusCode::FAILURE;
84  }
85  m_pmap = m_FPGATrackSimMapping->PlaneMap_1st(0);
86  // Get detector configurations
87  m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st(0)->getNLogiLayers();
88  m_nRegions = m_FPGATrackSimMapping->RegionMap_1st()->getNRegions();
89  m_nDim = m_FPGATrackSimMapping->PlaneMap_1st(0)->getNCoords();
90 
91  }
92  else {
93  m_pmap = m_FPGATrackSimMapping->PlaneMap_2nd(0);
94  // Get detector configurations
95  m_nLayers = m_FPGATrackSimMapping->PlaneMap_2nd(0)->getNLogiLayers();
96  m_nRegions = m_FPGATrackSimMapping->RegionMap_2nd()->getNRegions();
97  m_nDim = m_FPGATrackSimMapping->PlaneMap_2nd(0)->getNCoords();
98  }
99 
100  m_nDim2 = m_nDim * m_nDim;
101  m_sector_cum.resize(m_nRegions);
102 
103  // Retrieve slice information
104  m_sliceMin = m_EvtSel->getMin();
105  m_sliceMax = m_EvtSel->getMax();
106 
107  // Check q/pt binning information
108  if (m_qOverPtBins.size() == 0) {
109  ATH_MSG_ERROR("q/pt bin information not set in matrix element job options!");
110  return StatusCode::FAILURE;
111  }
112 
113 
114  // Histograms
116 
118 
119  return StatusCode::SUCCESS;
120 }
121 
122 
124 {
125  // Training tracks
126  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) {
127  std::string name = "h_trainingTrack_" + FPGATrackSimTrackPars::parName(i);
128  std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks passing pt/barcode check";
129 
130  m_h_trainingTrack[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]);
131  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_trainingTrack[i]));
132  }
133 
134  // Sector pars
135  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) {
136 
137  std::string name = "h_sectorPars_" + FPGATrackSimTrackPars::parName(i);
138  std::string title = "Average " + FPGATrackSimTrackPars::parName(i) + " in sector";
139 
140  m_h_sectorPars[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]);
141  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_sectorPars[i]));
142  }
143 
144  // Select hit failure
145  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) {
146 
147  std::string name = "h_SHfailure_" + FPGATrackSimTrackPars::parName(i);
148  std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks failing in selectHit()";
149 
150  m_h_SHfailure[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]);
151  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_SHfailure[i]));
152  }
153 
154  // 3 hits in layer
155  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) {
156 
157  std::string name = "h_3hitsInLayer_" + FPGATrackSimTrackPars::parName(i);
158  std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks containing 3+ hits in a single layer";
159 
160  m_h_3hitsInLayer[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]);
161  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_3hitsInLayer[i]));
162  }
163 
164  // Not enough hits
165  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++) {
166  std::string name = "h_notEnoughHits_" + FPGATrackSimTrackPars::parName(i);
167  std::string title = FPGATrackSimTrackPars::parName(i) + " of tracks failing because it didn't have enough hits";
168 
169  m_h_notEnoughHits[i] = new TH1I(name.c_str(), title.c_str(), 100, m_sliceMin[i], m_sliceMax[i]);
170  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/" + name, m_h_notEnoughHits[i]));
171  }
172 
173  m_h_trackQoP_okHits = new TH1I("h_trackQoP_okHits", "half inverse pt of tracks passing hit check",
175  m_h_trackQoP_okRegion = new TH1I("h_trackQoP_okRegion", "half inverse pt of tracks passing region check",
177  m_h_nHit = new TH1I("h_nHit", "number of hits in sector", 100, 0, 100);
178 
179  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_trackQoP_okHits", m_h_trackQoP_okHits));
180  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_trackQoP_okRegion", m_h_trackQoP_okRegion));
181  ATH_CHECK(m_tHistSvc->regHist("/TRIGFPGATrackSimMATRIXOUT/h_nHit",m_h_nHit));
182 
183  return StatusCode::SUCCESS;
184 }
185 
187 {
188  FPGATrackSimTrackPars pars = track.getPars();
189  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
190  hists[i]->Fill(pars[i]);
191 }
192 
194 // Execute
196 
197 
199 {
201  m_eventHeader->reset();
202 
203  // Get hits and training tracks from this event
204  ATH_CHECK(m_hitInputTool->readData(m_eventHeader, Gaudi::Hive::currentContext()));
205 
206  std::vector<FPGATrackSimHit> hits = getLogicalHits();
207 
208  std::vector<FPGATrackSimTruthTrack> truth_tracks = m_eventHeader->optional().getTruthTracks();
209  std::vector<FPGATrackSimTruthTrack> tracks = filterTrainingTracks(truth_tracks);
210 
211  m_nTracks += truth_tracks.size();
212  if (tracks.empty()) {
213  ATH_MSG_DEBUG("Empty training tracks");
214  return StatusCode::SUCCESS;
215  }
216 
217  // Prepare a map of the hits according the barcode
218  std::map<int, std::vector<FPGATrackSimHit>> barcode_hits = makeBarcodeMap(hits, tracks);
219 
220  // For each training track, find the sector it belongs to and accumulate the
221  // hit coordinates and track parameters.
222  for (FPGATrackSimTruthTrack const & track : tracks) {
223 
224  int nSlices = m_FPGATrackSimMapping->SubRegionMap()->getNRegions();
225  // Get list of hits associated to the current truth track
226  std::vector<FPGATrackSimHit> & track_hits = barcode_hits[track.getBarcode()];
227 
228  const FPGATrackSimPlaneMap *t_pmap = nullptr;
229 
230  // Get the hits that will form the actual sector
231 
232  for (int iSlice = 0; iSlice<nSlices; iSlice++){
233  t_pmap = m_FPGATrackSimMapping->PlaneMap_1st(iSlice);
234  for (auto & iHit : track_hits) {
235  t_pmap->map(iHit);
236  }
237  std::vector<FPGATrackSimHit> sector_hits;
238  bool success = filterSectorHits(track_hits, sector_hits, track, iSlice);
239  if (!success) continue; // Skip this track if it has bad hits (not complete, etc.)
240  m_h_trackQoP_okHits->Fill(track.getQOverPt());
241 
242  // Get the region of this sector
243  int region = getRegion(sector_hits);
244  if (region < 0 || region >= m_nRegions) continue;
245  m_h_trackQoP_okRegion->Fill(track.getQOverPt());
246 
247  //For the Hough constants, find the Hough roads
248  std::vector<std::shared_ptr<const FPGATrackSimRoad>> houghRoads;
249  if (m_doHoughConstants) {
250  std::vector<std::shared_ptr<const FPGATrackSimHit>> phits;
251 
252  for (const FPGATrackSimHit& hit : sector_hits) phits.emplace_back(std::make_shared<const FPGATrackSimHit>(hit));
253 
254  StatusCode sc = m_roadFinderTool->getRoads(phits, houghRoads);
255  if (sc.isFailure()) ATH_MSG_WARNING("Hough Transform -> getRoads() failed");
256 
257  if (!houghRoads.empty()){
258  double y = 0.0;
259  double x = 0.0;
260 
261  //For each Hough road, make the accumulator
262  for (auto const &hr : houghRoads){
263  y = hr->getY();
264  x = hr->getX();
265 
266  // Prepare the accumulator struct
267  std::vector<module_t> modules(m_nLayers);
269  acc.pars.qOverPt = y;
270  acc.pars.phi = x;
271  std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> modules_acc = {modules, acc};
272  ATH_CHECK(makeAccumulator(sector_hits, track, modules_acc));
273 
274  // Add the track to the accumulate map
275  accumulate(m_sector_cum[region], modules_acc.first, modules_acc.second);
276  m_nTracksUsed++;
277  }
278  } else {
279  ATH_MSG_DEBUG("execute(): no hough roads?");
280  return StatusCode::SUCCESS;
281  }
282  } else {
283  // Prepare the accumulator struct
284  std::vector<module_t> modules(m_nLayers);
286  std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> modules_acc = {modules, acc};
287  ATH_CHECK(makeAccumulator(sector_hits, track, modules_acc));
288 
289  // Add the track to the accumulate map
290  accumulate(m_sector_cum[region], modules_acc.first, modules_acc.second);
291  m_nTracksUsed++;
292  }
293  }
294  }
295 
296  return StatusCode::SUCCESS;
297 }
298 
299 
300 // Converts raw hits from header into logical hits, and filters those in FPGATrackSim layers
301 // Could replace this with the RawToLogical tool (but probably won't)
302 std::vector<FPGATrackSimHit> FPGATrackSimMatrixGenAlgo::getLogicalHits()
303 {
304  std::vector<FPGATrackSimHit> hits;
305  //Setup the logical header...
307  //Map the hits to the logical header...
308  unsigned stage = 0;
309  if (m_doHoughConstants) stage = 1; // For now Hough constants only works on 1st stage
310  else stage = 2;
311  StatusCode sc = m_hitMapTool->convert(stage, *m_eventHeader, logicalHeader);
312  if (sc.isFailure()) ATH_MSG_ERROR("Hit mapping failed");
313 
314  // Since the clustering tool modifies the logical towers-- refactored this
315  // to only access the output hits from the towers.
316  if (m_doClustering) {
317  std::vector<FPGATrackSimCluster> clustered_hits;
318  sc = m_clusteringTool->DoClustering(logicalHeader, clustered_hits);
319  if (sc.isFailure()) ATH_MSG_ERROR("Clustering failed");
320  }
321  // Optionally do spacepoints (as well).
322  if (m_doSpacePoints) {
323  std::vector<FPGATrackSimCluster> spacepoints;
324  sc = m_spacePointsTool->DoSpacePoints(logicalHeader, spacepoints);
325  if (sc.isFailure()) ATH_MSG_ERROR("Spacepoints failed");
326  }
327 
328  // It should now be safe to pull the towers, regardless.
329  std::vector<FPGATrackSimTowerInputHeader> towers = logicalHeader.towers();
330  for (auto &tower : towers) {
331  std::vector<FPGATrackSimHit> const & towerHits = tower.hits();
332  for (FPGATrackSimHit const & hit : towerHits) {
333  hits.push_back(hit);
334  }
335  }
336  return hits;
337 }
338 
339 
340 // Filters tracks based on m_PT_THRESHOLD and m_TRAING_PDG and D0_THRESHOLD
341 std::vector<FPGATrackSimTruthTrack> FPGATrackSimMatrixGenAlgo::filterTrainingTracks(std::vector<FPGATrackSimTruthTrack> const & truth_tracks) const
342 {
343  std::vector<FPGATrackSimTruthTrack> training_tracks;
344 
345  for (FPGATrackSimTruthTrack const & track : truth_tracks) {
346  if (HepMC::generations(&track) >= 1 || std::abs(track.getPDGCode()) != m_TRAIN_PDG) continue;
347  if (std::abs(track.getD0()) > m_D0_THRESHOLD) continue;
348 
349  double pt = TMath::Sqrt(track.getPX()*track.getPX() + track.getPY()*track.getPY());
350  double pt_GeV = pt / 1000;
351 
352  // Add the track to the list of good tracks
353  if (pt_GeV > m_PT_THRESHOLD) training_tracks.push_back(track);
354 
355  // Debug
356  if (msgLvl(MSG::DEBUG)) {
357  double c = track.getQ() /(2 * pt);
358  double eta = TMath::ASinH(track.getPZ() / pt);
359  double phi = TMath::ATan2(track.getPY(), track.getPX());
360  ATH_MSG_DEBUG("pt_GeV = "<< pt_GeV
361  << " c = " << c
362  << " eta = " << eta
363  << " phi = " << phi
364  << " pdgcode = " << track.getPDGCode());
365  }
367  }
368 
369  return training_tracks;
370 }
371 
372 
373 // Sorts 'hits' by barcodes appearing in 'tracks', drops the rest.
374 std::map<int, std::vector<FPGATrackSimHit>> FPGATrackSimMatrixGenAlgo::makeBarcodeMap(std::vector<FPGATrackSimHit> const & hits, std::vector<FPGATrackSimTruthTrack> const & tracks) const
375 {
376  std::map<int, std::vector<FPGATrackSimHit>> map;
377 
378  // Ready the barcodes
379  for (const FPGATrackSimTruthTrack & track : tracks)
380  map[track.getBarcode()] = std::vector<FPGATrackSimHit>();
381 
382  // Add the hits
383  for (const FPGATrackSimHit & hit : hits) {
384  // Get the predominant barcode for the current hit
385  int barcode = hit.getTruth().best_barcode();
386 
387  // Add hit to the list; skip the hits if not associated to a good truth tracks
388  auto it = map.find(barcode);
389  if (it != map.end()) (*it).second.push_back(hit);
390  }
391 
392  return map;
393 }
394 
395 
396 // Given two hits in the same layer, selects the better hit to use for sector
397 // generation based on multiple criteria.
398 //
399 // Returns:
400 // 0 - Failure, this track should be discarded
401 // 1 - Keep old hit
402 // 2 - Use new hit
403 //
404 // NB: sector overlap is a perfectly reasonable situation with forward disks
405 // eta and phi will differ in general in this case
406 // Take the lower-z hit preferentially (right thing to do? d0/pT tradeoff)
407 // But something fishy is going on if we've got two hits on the same disk.
409  int subregion) const
410 {
411  if ((new_hit.getSection() == old_hit.getSection()) && (new_hit.getLayer() == old_hit.getLayer())
412  && (new_hit.getEtaModule() == old_hit.getEtaModule()) && (new_hit.getPhiModule() == old_hit.getPhiModule())) {
413  ATH_MSG_DEBUG("Two hits on same module");
415  }
416 
417  // Always prefer spacepoints, regardless of all other considerations.
418  // This is necessary in part due to spacepoint duplication.
419  if (old_hit.getHitType() == HitType::spacepoint && new_hit.getHitType() != HitType::spacepoint) {
421  } else if (old_hit.getHitType() != HitType::spacepoint && new_hit.getHitType() == HitType::spacepoint) {
423  }
424 
425  int new_section = new_hit.getSection();
426  int old_section = old_hit.getSection();
427 
428  if (old_section == new_section) {
429 
430  if (old_hit.getEtaModule() == new_hit.getEtaModule()) {
431  int rmax = 0;
432  if (m_doHoughConstants) {
433  // Use the subregion map, not the region map, for these checks.
434  int phi_max = m_FPGATrackSimMapping->SubRegionMap()->getRegionBoundaries(subregion, new_hit.getLayer(), new_section).phi_max;
435  int phi_min = m_FPGATrackSimMapping->SubRegionMap()->getRegionBoundaries(subregion, new_hit.getLayer(), new_section).phi_min;
436 
437  rmax = phi_max - phi_min;
438  }
439  else {
440  // TODO: this needs updating, once we get the second stage going again.
441  int reg = m_FPGATrackSimMapping->RegionMap_2nd()->getRegions(new_hit)[0]; // just take region with lowest index
442 
443  int phi_max = m_FPGATrackSimMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_max;
444  int phi_min = m_FPGATrackSimMapping->RegionMap_2nd()->getRegionBoundaries(reg, new_hit.getLayer(), new_section).phi_min;
445 
446  rmax = phi_max - phi_min;
447  }
448 
449  int phi_diff = old_hit.getPhiModule() - new_hit.getPhiModule();
450 
451  if (phi_diff == 1 || phi_diff == -rmax) return selectHit_returnCode::SH_KEEP_OLD;
452  else if (phi_diff == -1 || phi_diff == rmax) return selectHit_returnCode::SH_KEEP_NEW;
453  else {
454  ATH_MSG_DEBUG("Hits are too far away in phi");
456  }
457  }
458  else { // Different eta is no good
459 
460  ATH_MSG_DEBUG("Hits are in different eta");
462  }
463  }
464  else { // sections are different
465 
466  int layer = old_hit.getLayer();
467  bool old_isEC = 0;
468  bool new_isEC = 0;
469  int old_disk = 0;
470  int new_disk = 0;
471  if (m_doHoughConstants) {
472  old_isEC = m_FPGATrackSimMapping->PlaneMap_1st(subregion)->isEC(layer, old_section);
473  new_isEC = m_FPGATrackSimMapping->PlaneMap_1st(subregion)->isEC(layer, new_section);
474  old_disk = m_FPGATrackSimMapping->PlaneMap_1st(subregion)->getLayerInfo(layer, old_section).physDisk;
475  new_disk = m_FPGATrackSimMapping->PlaneMap_1st(subregion)->getLayerInfo(layer, new_section).physDisk;
476  }
477  else {
478  // This will need updating, once we get to the second stage.
479  old_isEC = m_FPGATrackSimMapping->PlaneMap_2nd(subregion)->isEC(layer, old_section);
480  new_isEC = m_FPGATrackSimMapping->PlaneMap_2nd(subregion)->isEC(layer, new_section);
481  old_disk = m_FPGATrackSimMapping->PlaneMap_2nd(subregion)->getLayerInfo(layer, old_section).physDisk;
482  new_disk = m_FPGATrackSimMapping->PlaneMap_2nd(subregion)->getLayerInfo(layer, new_section).physDisk;
483  }
484  // If one is barrel and one endcap, it's definitely OK, take the barrel hit
485  if (old_isEC != new_isEC) {
486 
487  if (old_isEC) return selectHit_returnCode::SH_KEEP_NEW;
489  }
490  // Two endcap hits : same disk: discard
491  else if (old_disk == new_disk) {
492 
493  ATH_MSG_DEBUG("Two modules hit in same physical disk " << old_disk);
495  }
496  // Two endcap hits on same side: different disks: take the lower-z
497  else {
498  ATH_MSG_DEBUG("Keeping the lower-z of the two disks (" << old_disk << ", " << new_disk << ") hit");
499  if (old_disk > new_disk) return selectHit_returnCode::SH_KEEP_NEW;
501  }
502  }
503 }
504 
505 
506 // A sector is created from 8 hits in 8 layers. Sometimes there will be extraneous hits
507 // that need to be filtered. This functions returns true on success, and by reference
508 // the filtered hit list with size m_nLayers.
509 //
510 // the truth track is "temp" and could be removed in the future?
511 // See selectHit() for details on which hit is chosen when there's more than 1 per layer.
512 bool FPGATrackSimMatrixGenAlgo::filterSectorHits(std::vector<FPGATrackSimHit> const & all_hits, std::vector<FPGATrackSimHit> & sector_hits,
513  FPGATrackSimTruthTrack const & t, int subregion) const
514 {
515  FPGATrackSimHit nohit;
517  sector_hits.resize(m_nLayers, nohit);
518  std::vector<int> layer_count(m_nLayers); // count number of hits seen in each layer
519 
520  const FPGATrackSimRegionMap* rmap_1st = m_FPGATrackSimMapping->SubRegionMap();
521 
522  for (FPGATrackSimHit const & hit : all_hits) {
523  if (!hit.isMapped()){
524  continue;
525  }
526  // Sanity check. make sure the hit is actually in the first stage?
527  // If the hit falls within the boundaries of ANY subregion in the first stage, it's 1st stage.
528  if (rmap_1st->getRegions(hit).size() == 0) {
529  continue;
530  }
531  int layer = hit.getLayer();
532 
533  if (layer_count[layer] == 0){
534  layer_count[layer]++;
535  sector_hits[layer] = hit;
536  }
537  else if (layer_count[layer] == 1) {
538  layer_count[layer]++;
539 
540  // Already found a hit in this layer, so pick which hit to use.
541  // This needs to be subregion aware, unfortunately, so we use the right subrmap to do the checks.
542  selectHit_returnCode selected_hit = selectHit(sector_hits[layer], hit, subregion);
543 
544  if (selected_hit == selectHit_returnCode::SH_FAILURE) {
546  return false;
547  }
548  else if (selected_hit == selectHit_returnCode::SH_KEEP_NEW) sector_hits[layer] = hit;
549  }
550  else {
551  ATH_MSG_DEBUG("Too many hits on a plane, exiting filterHitsSec");
553  return false;
554  }
555  }
556 
557  // Count number of wildcards, spacepoints, and pixel hits.
558  int nwc = 0;
559  int num_sp = 0;
560  int num_pixel = 0;
561 
562  // Check we have the right number of hits
563  // Check we have the right number of hits.
564  for (int i = 0; i < m_nLayers; ++i)
565  {
566  if (layer_count[i] == 0)
567  {
568  ATH_MSG_DEBUG("Layer " << i << " has no hits");
569  nwc++;
570  }
571 
572  // Now that we've decided which hit to use-- check their type.
573  if (sector_hits[i].getHitType() == HitType::spacepoint) {
574  num_sp += 1;
575  }
576  if (sector_hits[i].isPixel()) {
577  num_pixel += 1;
578  }
579  }
580 
581  ATH_MSG_DEBUG("Found " << nwc << " wildcards compared to maximum: " << m_MaxWC);
582  // Divide by 2 due to spacepoint duplication.
583  num_sp /= 2;
584  ATH_MSG_DEBUG("Found " << num_sp << " spacepoints after removing duplicates.");
585  // Require we don't have too many wildcards.
586  if (nwc > m_MaxWC)
587  {
589  return false;
590  }
591  // Require that we have a certain number of "2D" hits (i.e. pixels and spacepoints)
592  // The effect of this is that we can ensure we have 4/5 2D hits but 7/9 hits total.
593  // NOTE Again, uncomment logic below for second stage running.
594  num_sp += num_pixel;
595  int minSpacePlusPixel = /*m_isSecondStage ? m_minSpacePlusPixel2 :*/ m_minSpacePlusPixel;
596  if (num_sp < minSpacePlusPixel) {
597  ATH_MSG_DEBUG("Not enough pixel hits + spacepoints (" << num_sp << " < " << minSpacePlusPixel << ")");
599  return false;
600  }
601  return true;
602 }
603 
604 
605 // Returns the lowest index region that contains all hits in 'hits'
606 int FPGATrackSimMatrixGenAlgo::getRegion(std::vector<FPGATrackSimHit> const & hits) const
607 {
608  // Start with a bitmask, all true, and set a region to false if any mismatch is found
609  std::vector<bool> region_mask(m_nRegions, true);
610 
611  for (FPGATrackSimHit const & hit : hits) {
612  if (hit.getHitType() != HitType::wildcard){ // don't worry about hits that are WCs
613  for (int region = 0; region < m_nRegions; region++) {
614  if (m_doHoughConstants) {
615  if (!m_FPGATrackSimMapping->RegionMap_1st()->isInRegion(region, hit))
616  region_mask[region] = false;
617  }
618  else {
619  if (!m_FPGATrackSimMapping->RegionMap_2nd()->isInRegion(region, hit))
620  region_mask[region] = false;
621  }
622  }
623  }
624  }
625 
626  // For now just give preference to lowest region index for simplicity
627  for (int region = 0; region < m_nRegions; region++)
628  if (region_mask[region])
629  return region;
630 
631  return -1;
632 }
633 
634 
635 // Given a track and corresponding hits, returns the sector (list of modules) and the accumulation
636 // struct.
637 StatusCode FPGATrackSimMatrixGenAlgo::makeAccumulator(std::vector<FPGATrackSimHit> const & sector_hits, FPGATrackSimTruthTrack const & track, std::pair<std::vector<module_t>, FPGATrackSimMatrixAccumulator> & accumulator) const
638 {
639  std::vector<module_t> modules(m_nLayers);
641 
642  //find the bin!
643  // NOTE: this only implements q/pt binning, not the subregion / eta pattern-based constants for now.
644  int sectorbin = 0;
645  double qoverpt = track.getQ() / track.getPt();
646  if (m_absQOverPtBinning) qoverpt = abs(qoverpt);
647  for (unsigned bin = 0; bin < m_qOverPtBins.size()-1; bin++) {
648  sectorbin = fpgatracksim::QPT_SECTOR_OFFSET * bin;
649  if (qoverpt < m_qOverPtBins[bin+1]) break;
650  }
651 
652  // Create sector definitions (list of modules)
653  std::string module_printout = "";
654  for (int i = 0; i < m_nLayers; i++)
655  {
656  if (sector_hits[i].getHitType() != HitType::wildcard) {
657  if (m_single) modules[i] = sector_hits[i].getIdentifierHash();
658  else {
659  modules[i] = sectorbin;
660  // Modify sectorbin by a "type" field, which for now means: 0 = not spacepoint, 1 = spacepoint.
661  // This will fail if we have more than 99 q/pt bins!
662  if (sector_hits[i].getHitType() == HitType::spacepoint) {
664  }
665  module_printout += std::to_string(modules[i]) + ", ";
666  }
667  }
668  else {
669  modules[i] = -1; // WC
670  }
671  }
672 
673  ATH_MSG_DEBUG("Generating track in sectorbin = " << sectorbin << " with modules: " << module_printout);
674 
675 
676  if (m_single) {
677  const int ToKeep[13] = {2200,2564,2861,3831,5368,14169,14173,20442,20446,29625,29629,42176,42180};
678  bool keepThis = true;
679  for (int i = 0; i < 13; i++) {
680  if (modules[i] != ToKeep[i] && modules[i] != -1) {
681  keepThis = false;
682  }
683  }
684 
685  if (!keepThis) {
686  for (int i = 0; i < 13; i++) modules[i] = -1;
687  }
688  else {
689  for (int i = 0; i < 13; i++) {
690  }
691  }
692  }
693 
694 
695  // Hough Constants parameters
696  double y = accumulator.second.pars.qOverPt;
697  double x = accumulator.second.pars.phi;
698 
699  // Vectorize (flatten) coordinates
700  std::vector<float> coords;
701 
702  for (int i = 0; i < m_nLayers; ++i) {
703  if (sector_hits[i].getHitType() != HitType::wildcard) {
704 
705  double target_r = m_FPGATrackSimMapping->RegionMap_1st()->getAvgRadius(0, i);
706 
707  // If this is a spacepoint the target R should be the average of the two layers.
708  // TODO, get this to be loaded in from a mean radii file into the mapping infrastructure.
709  if (sector_hits[i].getHitType() == HitType::spacepoint) {
710  int other_layer = (sector_hits[i].getSide() == 0) ? i + 1 : i - 1;
711  target_r = (target_r + m_FPGATrackSimMapping->RegionMap_1st()->getAvgRadius(0, other_layer)) / 2.;
712  }
713 
714  std::vector<float> coords_tmp;
715  if ( m_ideal_geom > 1 ) {
716  coords_tmp = computeIdealCoords(sector_hits[i], x, y, target_r, m_doDeltaPhiConsts, TrackCorrType::Second);
717  }
718  else {
719  coords_tmp = computeIdealCoords(sector_hits[i], x, y, target_r, m_doDeltaPhiConsts, TrackCorrType::None);
720  }
721 
722  // Create phi for any hits that are not spacepoints, as well as "inner" spacepoints.
723  // but not outer spacepoints. this avoids duplicate coordinates.
724  if (sector_hits[i].getHitType() != HitType::spacepoint || sector_hits[i].getSide() == 0) {
725  // get idealized gPhi
726  coords.push_back(coords_tmp[1]);
727  }
728 
729  // Create a z coordinate for the "outer" layer of the spacepoint and for 2D pixel hits.
730  // This means that a spacepoint will write out (phi, eta) pairs, but (0, phi) or (phi, 0) if it's missing.
731  if (sector_hits[i].getDim() == 2 || (sector_hits[i].getHitType() == HitType::spacepoint && (sector_hits[i].getPhysLayer() % 2) == 1)) {
732  // get idealized z
733  coords.push_back(coords_tmp[0]);
734  }
735  }
736  else {
737  if (m_pmap->getDim(i) == 2) {
738  coords.push_back(0);
739  }
740  coords.push_back(0);
741  }
742  }
743 
744  assert(coords.size() == (size_t)m_nDim);
745  acc.hit_coords = coords;
746  acc.hit_coordsG = coords;
747 
748  // Get the track parameters
749  acc.pars = track.getPars();
751  acc.pars.qOverPt = (y / 1000.0) - track.getQOverPt(); // fit for delta q/pT
752  acc.pars.phi = x - track.getPhi(); // fit for delta phi_0
753  }
754 
756  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
757  bins[i] = (acc.pars[i] - m_sliceMin[i]) * m_nBins[i] / (m_sliceMax[i] - m_sliceMin[i]);
758  acc.track_bins.push_back(bins);
759 
760  // Force phi to be in [0, 2pi] (post binning)
761  if (!m_doDeltaPhiConsts) {
762  while (acc.pars.phi < 0) acc.pars.phi += 2*M_PI;
763  while (acc.pars.phi > 2*M_PI) acc.pars.phi -= 2*M_PI;
764  }
765 
766  // Calculate the pre-multiplied elements
767  for (int i = 0; i < m_nDim; i++)
768  {
769  acc.hit_x_QoP[i] = coords[i] * acc.pars.qOverPt;
770  acc.hit_xG_HIP[i] = coords[i] * acc.pars.qOverPt;
771  acc.hit_x_d0[i] = coords[i] * acc.pars.d0;
772  acc.hit_x_z0[i] = coords[i] * acc.pars.z0;
773  acc.hit_x_eta[i] = coords[i] * acc.pars.eta;
774  acc.hit_xG_eta[i] = coords[i] * acc.pars.eta;
775  acc.hit_x_phi[i] = coords[i] * acc.pars.phi;
776 
777  for (int j = i; j < m_nDim; j++)
778  acc.covariance[i * m_nDim + j] = coords[i] * coords[j];
779 
780  for (int j = i; j < m_nDim; j++)
781  acc.covarianceG[i * m_nDim + j] = coords[i] * coords[j];
782  }
783 
784  accumulator = {modules, acc};
785  return StatusCode::SUCCESS;
786 }
787 
788 
789 
791 // Finalize
793 
794 
796 {
797  ATH_MSG_DEBUG("finalize()");
798  ATH_MSG_INFO("Tracks used: " << m_nTracksUsed << "/" << m_nTracks);
799 
800  for (int region = 0; region < m_nRegions; region++) {
801  // Create the tree
802  std::stringstream name;
803  std::stringstream title;
804  name << "am" << region;
805  title << "Ambank " << region << " parameters";
806  TTree* tree = new TTree(name.str().c_str(), title.str().c_str());
807  ATH_CHECK(m_tHistSvc->regTree(Form("/TRIGFPGATrackSimMATRIXOUT/%s",tree->GetName()), tree));
808 
809  // Fill the tree
811  // Monitoring
812  ATH_MSG_INFO("Sectors found in region " << region << ": " << m_sector_cum[region].size());
813  for (auto & sector_info : m_sector_cum[region]) {
814  double coverage = sector_info.second.track_bins.size();
815  m_h_nHit->Fill(coverage);
816  for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
817  m_h_sectorPars[i]->Fill(sector_info.second.pars[i] / coverage);
818  }
819  }
820 
821  writeSliceTree();
822  ATH_CHECK(m_tHistSvc->finalize());
823  return StatusCode::SUCCESS;
824 }
825 
826 
828 {
829  TTree* sliceTree = new TTree("slice", "Region slice boundaries"); // slice
830 
831  sliceTree->Branch("c_max", &m_sliceMax.qOverPt);
832  sliceTree->Branch("d0_max", &m_sliceMax.d0);
833  sliceTree->Branch("phi_max", &m_sliceMax.phi);
834  sliceTree->Branch("z0_max", &m_sliceMax.z0);
835  sliceTree->Branch("eta_max", &m_sliceMax.eta);
836 
837  sliceTree->Branch("c_min", &m_sliceMin.qOverPt);
838  sliceTree->Branch("d0_min", &m_sliceMin.d0);
839  sliceTree->Branch("phi_min", &m_sliceMin.phi);
840  sliceTree->Branch("z0_min", &m_sliceMin.z0);
841  sliceTree->Branch("eta_min", &m_sliceMin.eta);
842 
843  sliceTree->Branch("c_slices", &m_nBins.qOverPt);
844  sliceTree->Branch("d0_slices", &m_nBins.d0);
845  sliceTree->Branch("phi_slices", &m_nBins.phi);
846  sliceTree->Branch("z0_slices", &m_nBins.z0);
847  sliceTree->Branch("eta_slices", &m_nBins.eta);
848 
849  StatusCode sc = m_tHistSvc->regTree("/TRIGFPGATrackSimMATRIXOUT/slice",sliceTree);
850  if (sc.isFailure()) ATH_MSG_ERROR("tHist failed");
851 
852  sliceTree->Fill();
853 }
FPGATrackSimHit::getSection
unsigned getSection() const
Definition: FPGATrackSimHit.cxx:83
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
FPGATrackSimHit::getPhiModule
unsigned getPhiModule() const
Definition: FPGATrackSimHit.h:88
FPGATrackSimMatrixGenAlgo::m_hitMapTool
ToolHandle< FPGATrackSimRawToLogicalHitsTool > m_hitMapTool
Definition: FPGATrackSimMatrixGenAlgo.h:77
FPGATrackSimMatrixGenAlgo::getLogicalHits
std::vector< FPGATrackSimHit > getLogicalHits()
Definition: FPGATrackSimMatrixGenAlgo.cxx:302
FPGATrackSimMatrixGenAlgo::m_qOverPtBins
Gaudi::Property< std::vector< double > > m_qOverPtBins
Definition: FPGATrackSimMatrixGenAlgo.h:114
FPGATrackSimMatrixGenAlgo::m_temp_z0_max
Gaudi::Property< float > m_temp_z0_max
Definition: FPGATrackSimMatrixGenAlgo.h:105
FPGATrackSimMatrixGenAlgo::m_temp_d0_max
Gaudi::Property< float > m_temp_d0_max
Definition: FPGATrackSimMatrixGenAlgo.h:103
FPGATrackSimMatrixGenAlgo::makeAccumulator
StatusCode makeAccumulator(std::vector< FPGATrackSimHit > const &sector_hits, FPGATrackSimTruthTrack const &track, std::pair< std::vector< module_t >, FPGATrackSimMatrixAccumulator > &accumulator) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:637
FPGATrackSimMatrixGenAlgo::m_temp_phi_max
Gaudi::Property< float > m_temp_phi_max
Definition: FPGATrackSimMatrixGenAlgo.h:101
FPGATrackSimTrackPars::phi
double phi
Definition: FPGATrackSimTrackPars.h:24
FPGATrackSimMatrixGenAlgo::m_temp_d0_min
Gaudi::Property< float > m_temp_d0_min
Definition: FPGATrackSimMatrixGenAlgo.h:102
FPGATrackSimLogicalEventInputHeader
Definition: FPGATrackSimLogicalEventInputHeader.h:21
FPGATrackSimRegionSlices.h
Stores slice definitions for FPGATrackSim regions.
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
python.FPGATrackSimAnalysisConfig.stage
stage
Definition: FPGATrackSimAnalysisConfig.py:558
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
FPGATrackSimTrackParsI::eta
int eta
Definition: FPGATrackSimTrackPars.h:62
FPGATrackSimMatrixGenAlgo::m_minSpacePlusPixel
Gaudi::Property< int > m_minSpacePlusPixel
Definition: FPGATrackSimMatrixGenAlgo.h:94
FPGATrackSimMatrixGenAlgo::getRegion
int getRegion(std::vector< FPGATrackSimHit > const &hits) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:606
FPGATrackSimMatrixGenAlgo::m_nTracksUsed
size_t m_nTracksUsed
Definition: FPGATrackSimMatrixGenAlgo.h:130
FPGATrackSimMatrixGenAlgo::makeBarcodeMap
std::map< int, std::vector< FPGATrackSimHit > > makeBarcodeMap(std::vector< FPGATrackSimHit > const &hits, std::vector< FPGATrackSimTruthTrack > const &tracks) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:374
FPGATrackSimTrackPars
Definition: FPGATrackSimTrackPars.h:22
FPGATrackSimTrackPars::qOverPt
double qOverPt
Definition: FPGATrackSimTrackPars.h:25
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
FPGATrackSimMatrixGenAlgo::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimMatrixGenAlgo.h:72
FPGATrackSimMatrixGenAlgo::m_temp_z0_slices
Gaudi::Property< int > m_temp_z0_slices
Definition: FPGATrackSimMatrixGenAlgo.h:111
fpgatracksim::SPACEPOINT_SECTOR_OFFSET
constexpr int SPACEPOINT_SECTOR_OFFSET
Definition: FPGATrackSimConstants.h:22
FPGATrackSimTruthTrack
Definition: FPGATrackSimTruthTrack.h:14
accumulate
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
Definition: FPGATrackSimMatrixAccumulator.cxx:22
tree
TChain * tree
Definition: tile_monitor.h:30
FPGATrackSimTrackPars::d0
double d0
Definition: FPGATrackSimTrackPars.h:26
skel.it
it
Definition: skel.GENtoEVGEN.py:396
FPGATrackSimHit::getLayer
unsigned getLayer() const
Definition: FPGATrackSimHit.cxx:77
TrackCorrType::Second
@ Second
BindingsTest.hr
hr
Definition: BindingsTest.py:23
test_pyathena.pt
pt
Definition: test_pyathena.py:11
FPGATrackSimMatrixGenAlgo::filterTrainingTracks
std::vector< FPGATrackSimTruthTrack > filterTrainingTracks(std::vector< FPGATrackSimTruthTrack > const &truth_tracks) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:341
M_PI
#define M_PI
Definition: ActiveFraction.h:11
bin
Definition: BinsDiffFromStripMedian.h:43
AthCommonMsg< Algorithm >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
FPGATrackSimMatrixGenAlgo::m_nDim
int m_nDim
Definition: FPGATrackSimMatrixGenAlgo.h:117
FPGATrackSimTrackParsI::d0
int d0
Definition: FPGATrackSimTrackPars.h:60
FPGATrackSimMatrixGenAlgo::writeSliceTree
void writeSliceTree()
Definition: FPGATrackSimMatrixGenAlgo.cxx:827
HitType::spacepoint
@ spacepoint
FPGATrackSimHit::getEtaModule
int getEtaModule() const
Definition: FPGATrackSimHit.h:87
FPGATrackSimMatrixGenAlgo::m_ideal_geom
Gaudi::Property< int > m_ideal_geom
Definition: FPGATrackSimMatrixGenAlgo.h:89
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
FPGATrackSimMatrixGenAlgo::m_temp_phi_min
Gaudi::Property< float > m_temp_phi_min
Definition: FPGATrackSimMatrixGenAlgo.h:100
FPGATrackSimTrackPars::eta
double eta
Definition: FPGATrackSimTrackPars.h:28
FPGATrackSimMatrixGenAlgo::m_D0_THRESHOLD
Gaudi::Property< float > m_D0_THRESHOLD
Definition: FPGATrackSimMatrixGenAlgo.h:96
FPGATrackSimMatrixGenAlgo::m_temp_z0_min
Gaudi::Property< float > m_temp_z0_min
Definition: FPGATrackSimMatrixGenAlgo.h:104
x
#define x
FPGATrackSimMatrixGenAlgo::m_temp_eta_slices
Gaudi::Property< int > m_temp_eta_slices
Definition: FPGATrackSimMatrixGenAlgo.h:112
FPGATrackSimMatrixGenAlgo::m_temp_eta_min
Gaudi::Property< float > m_temp_eta_min
Definition: FPGATrackSimMatrixGenAlgo.h:106
FPGATrackSimMatrixGenAlgo::selectHit_returnCode::SH_FAILURE
@ SH_FAILURE
FPGATrackSimMatrixGenAlgo::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimMatrixGenAlgo.h:73
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
FPGATrackSimConstants.h
FPGATrackSimOptionalEventInfo::getTruthTracks
const std::vector< FPGATrackSimTruthTrack > & getTruthTracks() const
Definition: FPGATrackSimOptionalEventInfo.h:37
FPGATrackSimHit
Definition: FPGATrackSimHit.h:41
FPGATrackSimPlaneMap::getDim
uint32_t getDim(size_t logiLayer) const
Definition: FPGATrackSimPlaneMap.h:78
HitType::wildcard
@ wildcard
FPGATrackSimMatrixGenAlgo::m_doHoughConstants
Gaudi::Property< bool > m_doHoughConstants
Definition: FPGATrackSimMatrixGenAlgo.h:91
fillTree
void fillTree(AccumulateMap &map, TTree *tree, int nLayers, int nCoords)
Writes the contents of an AccumulateMap into the supplied tree (one entry per sector).
Definition: FPGATrackSimMatrixIO.cxx:226
computeIdealCoords
std::vector< float > computeIdealCoords(const FPGATrackSimHit &hit, const double hough_x, const double hough_y, const double target_r, const bool doDeltaGPhis, const TrackCorrType trackCorrType)
Definition: FPGATrackSimFunctions.cxx:116
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
FPGATrackSimMatrixGenAlgo::initialize
StatusCode initialize() override
Definition: FPGATrackSimMatrixGenAlgo.cxx:47
FPGATrackSimMatrixGenAlgo::FPGATrackSimMatrixGenAlgo
FPGATrackSimMatrixGenAlgo(const std::string &name, ISvcLocator *pSvcLocator)
Definition: FPGATrackSimMatrixGenAlgo.cxx:36
FPGATrackSimMatrixGenAlgo::m_sliceMax
FPGATrackSimTrackPars m_sliceMax
Definition: FPGATrackSimMatrixGenAlgo.h:121
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
FPGATrackSimMatrixGenAlgo::m_temp_c_min
Gaudi::Property< float > m_temp_c_min
Definition: FPGATrackSimMatrixGenAlgo.h:98
FPGATrackSimMatrixGenAlgo::m_nRegions
Gaudi::Property< int > m_nRegions
Definition: FPGATrackSimMatrixGenAlgo.h:86
FPGATrackSimPlaneMap::map
void map(FPGATrackSimHit &hit) const
Definition: FPGATrackSimPlaneMap.cxx:234
FPGATrackSimMatrixGenAlgo::selectHit_returnCode::SH_KEEP_OLD
@ SH_KEEP_OLD
FPGATrackSimMatrixGenAlgo::m_single
Gaudi::Property< bool > m_single
Definition: FPGATrackSimMatrixGenAlgo.h:90
lumiFormat.i
int i
Definition: lumiFormat.py:85
FPGATrackSimEventInputHeader::clearHits
void clearHits()
Definition: FPGATrackSimEventInputHeader.h:40
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
FPGATrackSimMatrixAccumulator
Definition: FPGATrackSimMatrixAccumulator.h:36
FPGATrackSimMatrixGenAlgo::m_spacePointsTool
ToolHandle< FPGATrackSimSpacePointsToolI > m_spacePointsTool
Definition: FPGATrackSimMatrixGenAlgo.h:79
FPGATrackSimMatrixGenAlgo::m_h_sectorPars
TH1I * m_h_sectorPars[FPGATrackSimTrackPars::NPARS]
Definition: FPGATrackSimMatrixGenAlgo.h:154
FPGATrackSimMatrixGenAlgo.h
Algorithm to generate matrix files, to be used for sector and constant generation.
covarianceTool.title
title
Definition: covarianceTool.py:542
FPGATrackSimMatrixGenAlgo::m_hitInputTool
ToolHandle< IFPGATrackSimInputTool > m_hitInputTool
Definition: FPGATrackSimMatrixGenAlgo.h:76
FPGATrackSimMatrixGenAlgo::m_temp_d0_slices
Gaudi::Property< int > m_temp_d0_slices
Definition: FPGATrackSimMatrixGenAlgo.h:110
FPGATrackSimMatrixGenAlgo::m_h_trackQoP_okHits
TH1I * m_h_trackQoP_okHits
Definition: FPGATrackSimMatrixGenAlgo.h:159
FPGATrackSimMatrixGenAlgo::m_doDeltaPhiConsts
Gaudi::Property< bool > m_doDeltaPhiConsts
Definition: FPGATrackSimMatrixGenAlgo.h:92
FPGATrackSimMatrixGenAlgo::m_PT_THRESHOLD
Gaudi::Property< float > m_PT_THRESHOLD
Definition: FPGATrackSimMatrixGenAlgo.h:95
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MakeTH3DFromTH2Ds.hists
hists
Definition: MakeTH3DFromTH2Ds.py:72
FPGATrackSimEventInputHeader
Definition: FPGATrackSimEventInputHeader.h:22
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
FPGATrackSimMatrixGenAlgo::m_temp_phi_slices
Gaudi::Property< int > m_temp_phi_slices
Definition: FPGATrackSimMatrixGenAlgo.h:109
FPGATrackSimMatrixGenAlgo::m_doSpacePoints
Gaudi::Property< bool > m_doSpacePoints
Definition: FPGATrackSimMatrixGenAlgo.h:88
FPGATrackSimMatrixGenAlgo::execute
StatusCode execute() override
Definition: FPGATrackSimMatrixGenAlgo.cxx:198
FPGATrackSimMatrixGenAlgo::m_absQOverPtBinning
Gaudi::Property< bool > m_absQOverPtBinning
Definition: FPGATrackSimMatrixGenAlgo.h:113
FPGATrackSimMatrixGenAlgo::m_doClustering
Gaudi::Property< bool > m_doClustering
Definition: FPGATrackSimMatrixGenAlgo.h:87
FPGATrackSimRegionMap::getRegions
std::vector< uint32_t > getRegions(const FPGATrackSimHit &hit) const
Definition: FPGATrackSimRegionMap.cxx:282
FPGATrackSimMatrixGenAlgo::m_clusteringTool
ToolHandle< FPGATrackSimClusteringToolI > m_clusteringTool
Definition: FPGATrackSimMatrixGenAlgo.h:78
FPGATrackSimMatrixGenAlgo::m_eventHeader
FPGATrackSimEventInputHeader * m_eventHeader
Definition: FPGATrackSimMatrixGenAlgo.h:124
FPGATrackSimMatrixGenAlgo::bookHistograms
StatusCode bookHistograms()
Definition: FPGATrackSimMatrixGenAlgo.cxx:123
AthAlgorithm
Definition: AthAlgorithm.h:47
FPGATrackSimMatrixGenAlgo::filterSectorHits
bool filterSectorHits(std::vector< FPGATrackSimHit > const &all_hits, std::vector< FPGATrackSimHit > &sector_hits, FPGATrackSimTruthTrack const &t, int subregion) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:512
FPGATrackSimMatrixGenAlgo::m_h_notEnoughHits
TH1I * m_h_notEnoughHits[FPGATrackSimTrackPars::NPARS]
Definition: FPGATrackSimMatrixGenAlgo.h:157
FPGATrackSimPlaneMap
Definition: FPGATrackSimPlaneMap.h:62
FPGATrackSimMatrixGenAlgo::m_nTracks
size_t m_nTracks
Definition: FPGATrackSimMatrixGenAlgo.h:129
fpgatracksim::QPT_SECTOR_OFFSET
constexpr int QPT_SECTOR_OFFSET
Definition: FPGATrackSimConstants.h:23
FPGATrackSimMatrixAccumulator.h
Helper struct for accumulating sector information for matrix generation.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
MagicNumbers.h
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrackCorrType::None
@ None
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
FPGATrackSimFunctions.h
FPGATrackSimMatrixGenAlgo::selectHit_returnCode::SH_KEEP_NEW
@ SH_KEEP_NEW
FPGATrackSimMatrixGenAlgo::m_h_3hitsInLayer
TH1I * m_h_3hitsInLayer[FPGATrackSimTrackPars::NPARS]
Definition: FPGATrackSimMatrixGenAlgo.h:156
FPGATrackSimMatrixGenAlgo::m_sector_cum
std::vector< AccumulateMap > m_sector_cum
Definition: FPGATrackSimMatrixGenAlgo.h:67
FPGATrackSimMatrixGenAlgo::m_h_SHfailure
TH1I * m_h_SHfailure[FPGATrackSimTrackPars::NPARS]
Definition: FPGATrackSimMatrixGenAlgo.h:155
FPGATrackSimTrackPars::parName
static std::string parName(unsigned i)
Definition: FPGATrackSimTrackPars.cxx:72
FPGATrackSimEventInputHeader::optional
FPGATrackSimOptionalEventInfo const & optional() const
Definition: FPGATrackSimEventInputHeader.h:34
FPGATrackSimMatrixGenAlgo::m_nLayers
int m_nLayers
Definition: FPGATrackSimMatrixGenAlgo.h:116
FPGATrackSimTrackParsI::phi
int phi
Definition: FPGATrackSimTrackPars.h:58
FPGATrackSimMatrixGenAlgo::m_temp_c_max
Gaudi::Property< float > m_temp_c_max
Definition: FPGATrackSimMatrixGenAlgo.h:99
FPGATrackSimMatrixGenAlgo::selectHit
selectHit_returnCode selectHit(FPGATrackSimHit const &old_hit, FPGATrackSimHit const &new_hit, int subregion) const
Definition: FPGATrackSimMatrixGenAlgo.cxx:408
fillTrackPars
void fillTrackPars(TH1I *const hists[FPGATrackSimTrackPars::NPARS], FPGATrackSimTruthTrack const &track)
Definition: FPGATrackSimMatrixGenAlgo.cxx:186
y
#define y
FPGATrackSimMatrixGenAlgo::m_nDim2
int m_nDim2
Definition: FPGATrackSimMatrixGenAlgo.h:118
RunTileMonitoring.towers
towers
Definition: RunTileMonitoring.py:133
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
FPGATrackSimMatrixGenAlgo::m_h_trackQoP_okRegion
TH1I * m_h_trackQoP_okRegion
Definition: FPGATrackSimMatrixGenAlgo.h:160
FPGATrackSimTrackPars::z0
double z0
Definition: FPGATrackSimTrackPars.h:27
FPGATrackSimMatrixGenAlgo::m_sliceMin
FPGATrackSimTrackPars m_sliceMin
Definition: FPGATrackSimMatrixGenAlgo.h:120
FPGATrackSimMatrixGenAlgo::m_h_trainingTrack
TH1I * m_h_trainingTrack[FPGATrackSimTrackPars::NPARS]
Definition: FPGATrackSimMatrixGenAlgo.h:153
DEBUG
#define DEBUG
Definition: page_access.h:11
FPGATrackSimTrackPars::NPARS
@ NPARS
Definition: FPGATrackSimTrackPars.h:49
FPGATrackSimMatrixGenAlgo::m_MaxWC
Gaudi::Property< int > m_MaxWC
Definition: FPGATrackSimMatrixGenAlgo.h:93
FPGATrackSimMatrixGenAlgo::m_TRAIN_PDG
Gaudi::Property< int > m_TRAIN_PDG
Definition: FPGATrackSimMatrixGenAlgo.h:97
FPGATrackSimMatrixGenAlgo::m_roadFinderTool
ToolHandle< FPGATrackSimRoadUnionTool > m_roadFinderTool
Definition: FPGATrackSimMatrixGenAlgo.h:80
FPGATrackSimTrackParsI::z0
int z0
Definition: FPGATrackSimTrackPars.h:61
FPGATrackSimMatrixGenAlgo::m_nBins
FPGATrackSimTrackParsI m_nBins
Definition: FPGATrackSimMatrixGenAlgo.h:122
FPGATrackSimMatrixGenAlgo::m_h_nHit
TH1I * m_h_nHit
Definition: FPGATrackSimMatrixGenAlgo.h:161
FPGATrackSimMatrixGenAlgo::finalize
StatusCode finalize() override
Definition: FPGATrackSimMatrixGenAlgo.cxx:795
FPGATrackSimRegionMap
Definition: FPGATrackSimRegionMap.h:62
FPGATrackSimLogicalEventInputHeader::towers
const std::vector< FPGATrackSimTowerInputHeader > & towers() const
Definition: FPGATrackSimLogicalEventInputHeader.h:36
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
FPGATrackSimTrackParsI::qOverPt
int qOverPt
Definition: FPGATrackSimTrackPars.h:59
FPGATrackSimTrackParsI
Definition: FPGATrackSimTrackPars.h:56
HepMC::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...
Definition: MagicNumbers.h:358
FPGATrackSimMatrixGenAlgo::m_tHistSvc
ServiceHandle< ITHistSvc > m_tHistSvc
Definition: FPGATrackSimMatrixGenAlgo.h:74
FPGATrackSimMatrixGenAlgo::m_temp_eta_max
Gaudi::Property< float > m_temp_eta_max
Definition: FPGATrackSimMatrixGenAlgo.h:107
FPGATrackSimEventInputHeader::reset
void reset()
Definition: FPGATrackSimEventInputHeader.cxx:14
FPGATrackSimMatrixGenAlgo::m_pmap
const FPGATrackSimPlaneMap * m_pmap
Definition: FPGATrackSimMatrixGenAlgo.h:81
python.compressB64.c
def c
Definition: compressB64.py:93
FPGATrackSimMatrixGenAlgo::selectHit_returnCode
selectHit_returnCode
Definition: FPGATrackSimMatrixGenAlgo.h:135
FPGATrackSimHit::getHitType
HitType getHitType() const
Definition: FPGATrackSimHit.h:57
FPGATrackSimMatrixGenAlgo::m_temp_c_slices
Gaudi::Property< int > m_temp_c_slices
Definition: FPGATrackSimMatrixGenAlgo.h:108
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:54
LArGeo::ATan2
GeoGenfun::FunctionNoop ATan2(GeoGenfun::GENFUNCTION y, GeoGenfun::GENFUNCTION x)
Definition: BarrelAuxFunctions.cxx:50