ATLAS Offline Software
Loading...
Searching...
No Matches
FPGATrackSimPhiRoadFilterTool Class Reference

#include <FPGATrackSimPhiRoadFilterTool.h>

Inheritance diagram for FPGATrackSimPhiRoadFilterTool:
Collaboration diagram for FPGATrackSimPhiRoadFilterTool:

Public Member Functions

 FPGATrackSimPhiRoadFilterTool (const std::string &, const std::string &, const IInterface *)
virtual StatusCode initialize () override
virtual StatusCode filterRoads (std::vector< std::shared_ptr< const FPGATrackSimRoad > > &prefilter_roads, std::vector< std::shared_ptr< const FPGATrackSimRoad > > &postfilter_roads) override

Private Member Functions

FPGATrackSimRoad buildRoad (std::shared_ptr< const FPGATrackSimRoad > origr) const

Private Attributes

ServiceHandle< IFPGATrackSimMappingSvcm_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}
ServiceHandle< IFPGATrackSimEventSelectionSvcm_EvtSel {this, "FPGATrackSimEventSelectionSvc", ""}
Gaudi::Property< unsigned > m_threshold {this, "threshold", 0, "Minimum number of hit layers to fire a road"}
Gaudi::Property< std::vector< float > > m_window {this, "window", {}, "Distance from nominal path to keep hit, list of length nLayers"}
Gaudi::Property< float > m_ptscaling {this, "ptscaling", 0.0, "Add a pT dependent resolution to each resolution in window"}
Gaudi::Property< bool > m_fieldCorrection {this, "fieldCorrection", true, "Apply B field correction"}
std::vector< FPGATrackSimRoadm_postfilter_roads
unsigned m_nLayers = 0U
unsigned m_event = 0
std::string m_name

Detailed Description

Definition at line 38 of file FPGATrackSimPhiRoadFilterTool.h.

Constructor & Destructor Documentation

◆ FPGATrackSimPhiRoadFilterTool()

FPGATrackSimPhiRoadFilterTool::FPGATrackSimPhiRoadFilterTool ( const std::string & algname,
const std::string & name,
const IInterface * ifc )

Definition at line 33 of file FPGATrackSimPhiRoadFilterTool.cxx.

33 :
34 base_class(algname, name, ifc),
36{
37}
static std::string instance_name(std::string const &s)

Member Function Documentation

◆ buildRoad()

FPGATrackSimRoad FPGATrackSimPhiRoadFilterTool::buildRoad ( std::shared_ptr< const FPGATrackSimRoad > origr) const
private

Definition at line 85 of file FPGATrackSimPhiRoadFilterTool.cxx.

86{
87 ATH_MSG_DEBUG("PhiRoad Build Road");
88 float phi = origr->getX();
89 float qPt = origr->getY();
90
91 // make new road -- main alg doesn't keep it if not needed
92 FPGATrackSimRoad r(*origr); // only works with Hough roads!
93 r.setNLayers(m_nLayers);
94 layer_bitmask_t hitLayers = 0;
95
96 // add hits
97 for (unsigned lyr = 0; lyr < m_nLayers; lyr++) {
98 std::vector<std::shared_ptr<const FPGATrackSimHit>> road_hits;
99 for (auto &hit : origr->getHits(lyr)) {
100 float phi_expected = -1.0*asin(fpgatracksim::A * hit->getR() * qPt) + phi;
101 if (m_fieldCorrection) phi_expected -= fieldCorrection(m_EvtSel->getRegionID(), qPt, hit->getR());
102 if (abs(hit->getGPhi()-phi_expected)< (m_window.value()[lyr]+qPt*m_ptscaling)) {
103 road_hits.push_back(hit);
104 hitLayers |= 1 << hit->getLayer();
105 }
106 }
107 if (road_hits.size() == 0) {
108 std::unique_ptr<FPGATrackSimHit> wcHit = std::make_unique<FPGATrackSimHit>();
109 wcHit->setHitType(HitType::wildcard);
110 wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st(0)->getDetType(lyr));
111 wcHit->setLayer(lyr);
112 road_hits.push_back(std::move(wcHit));
113 }
114 ATH_MSG_DEBUG("PhiRoad Hits " << lyr << " " << road_hits.size() << " " << origr->getHits(lyr).size());
115 r.setHits(lyr,std::move(road_hits));
116 }
117
118 r.setHitLayers(hitLayers);
119 return r;
120}
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x)
double fieldCorrection(unsigned region, double qoverpt, double r)
uint32_t layer_bitmask_t
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Gaudi::Property< std::vector< float > > m_window
int r
Definition globals.cxx:22
static constexpr double A

◆ filterRoads()

StatusCode FPGATrackSimPhiRoadFilterTool::filterRoads ( std::vector< std::shared_ptr< const FPGATrackSimRoad > > & prefilter_roads,
std::vector< std::shared_ptr< const FPGATrackSimRoad > > & postfilter_roads )
overridevirtual

Definition at line 52 of file FPGATrackSimPhiRoadFilterTool.cxx.

53{
54 ATH_MSG_DEBUG("Start Phi Road Filter");
55
56 m_postfilter_roads.clear();
57 postfilter_roads.clear();
58
59 // Filter roads
60 for (auto const & road : prefilter_roads) {
61 FPGATrackSimRoad newroad = buildRoad(road);
62 unsigned hit_layers = newroad.getHitLayers();
63
64 unsigned layer_cnt=0;
65 for (unsigned lyr = 0; lyr < m_nLayers; lyr++) {
66 if (hit_layers & (1<<lyr)) layer_cnt++;
67 }
68
69 if (layer_cnt >= m_threshold.value()) {
70 m_postfilter_roads.push_back(std::move(newroad));
71 }
72
73 }
74
75 // copy roads to outputs
76 postfilter_roads.reserve(m_postfilter_roads.size());
77 for (FPGATrackSimRoad & r : m_postfilter_roads) postfilter_roads.emplace_back(std::make_shared<const FPGATrackSimRoad>(r));
78
79 ATH_MSG_DEBUG("Event Done");
80
81 m_event++;
82 return StatusCode::SUCCESS;
83}
std::vector< FPGATrackSimRoad > m_postfilter_roads
FPGATrackSimRoad buildRoad(std::shared_ptr< const FPGATrackSimRoad > origr) const
layer_bitmask_t getHitLayers() const

◆ initialize()

StatusCode FPGATrackSimPhiRoadFilterTool::initialize ( )
overridevirtual

Definition at line 40 of file FPGATrackSimPhiRoadFilterTool.cxx.

41{
42 // Retrieve info
44 m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st(0)->getNLogiLayers();
45 return StatusCode::SUCCESS;
46}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_event

unsigned FPGATrackSimPhiRoadFilterTool::m_event = 0
private

Definition at line 80 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_EvtSel

ServiceHandle<IFPGATrackSimEventSelectionSvc> FPGATrackSimPhiRoadFilterTool::m_EvtSel {this, "FPGATrackSimEventSelectionSvc", ""}
private

Definition at line 59 of file FPGATrackSimPhiRoadFilterTool.h.

59{this, "FPGATrackSimEventSelectionSvc", ""};

◆ m_fieldCorrection

Gaudi::Property<bool> FPGATrackSimPhiRoadFilterTool::m_fieldCorrection {this, "fieldCorrection", true, "Apply B field correction"}
private

Definition at line 67 of file FPGATrackSimPhiRoadFilterTool.h.

67{this, "fieldCorrection", true, "Apply B field correction"};

◆ m_FPGATrackSimMapping

ServiceHandle<IFPGATrackSimMappingSvc> FPGATrackSimPhiRoadFilterTool::m_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}
private

Definition at line 58 of file FPGATrackSimPhiRoadFilterTool.h.

58{this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"};

◆ m_name

std::string FPGATrackSimPhiRoadFilterTool::m_name
private

Definition at line 81 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_nLayers

unsigned FPGATrackSimPhiRoadFilterTool::m_nLayers = 0U
private

Definition at line 75 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_postfilter_roads

std::vector<FPGATrackSimRoad> FPGATrackSimPhiRoadFilterTool::m_postfilter_roads
private

Definition at line 71 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_ptscaling

Gaudi::Property<float> FPGATrackSimPhiRoadFilterTool::m_ptscaling {this, "ptscaling", 0.0, "Add a pT dependent resolution to each resolution in window"}
private

Definition at line 66 of file FPGATrackSimPhiRoadFilterTool.h.

66{this, "ptscaling", 0.0, "Add a pT dependent resolution to each resolution in window"};

◆ m_threshold

Gaudi::Property<unsigned> FPGATrackSimPhiRoadFilterTool::m_threshold {this, "threshold", 0, "Minimum number of hit layers to fire a road"}
private

Definition at line 64 of file FPGATrackSimPhiRoadFilterTool.h.

64{this, "threshold", 0, "Minimum number of hit layers to fire a road"};

◆ m_window

Gaudi::Property<std::vector<float> > FPGATrackSimPhiRoadFilterTool::m_window {this, "window", {}, "Distance from nominal path to keep hit, list of length nLayers"}
private

Definition at line 65 of file FPGATrackSimPhiRoadFilterTool.h.

65{this, "window", {}, "Distance from nominal path to keep hit, list of length nLayers"};

The documentation for this class was generated from the following files: