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< FPGATrackSimRoad > &prefilter_roads, std::vector< FPGATrackSimRoad > &postfilter_roads) override

Private Member Functions

FPGATrackSimRoad buildRoad (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 ( const FPGATrackSimRoad & origr) const
private

Definition at line 83 of file FPGATrackSimPhiRoadFilterTool.cxx.

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

◆ filterRoads()

StatusCode FPGATrackSimPhiRoadFilterTool::filterRoads ( std::vector< FPGATrackSimRoad > & prefilter_roads,
std::vector< 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 postfilter_roads = std::move(m_postfilter_roads);
76
77 ATH_MSG_DEBUG("Event Done");
78
79 m_event++;
80 return StatusCode::SUCCESS;
81}
std::vector< FPGATrackSimRoad > m_postfilter_roads
FPGATrackSimRoad buildRoad(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: