ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 (const std::vector< FPGATrackSimRoad * > &prefilter_roads, std::vector< FPGATrackSimRoad * > &postfilter_roads) override
 

Private Member Functions

FPGATrackSimRoad buildRoad (FPGATrackSimRoad *origr) const
 

Private Attributes

ServiceHandle< IFPGATrackSimMappingSvcm_FPGATrackSimMapping {this, "FPGATrackSimMappingSvc", "FPGATrackSimMappingSvc"}
 
ServiceHandle< IFPGATrackSimEventSelectionSvcm_EvtSel {this, "FPGATrackSimEventSelectionSvc", "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 37 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),
35  m_name(instance_name(name))
36 {
37  declareInterface<IFPGATrackSimRoadFilterTool>(this);
38 }

Member Function Documentation

◆ buildRoad()

FPGATrackSimRoad FPGATrackSimPhiRoadFilterTool::buildRoad ( FPGATrackSimRoad origr) const
private

Definition at line 86 of file FPGATrackSimPhiRoadFilterTool.cxx.

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

◆ filterRoads()

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

Definition at line 53 of file FPGATrackSimPhiRoadFilterTool.cxx.

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

◆ initialize()

StatusCode FPGATrackSimPhiRoadFilterTool::initialize ( )
overridevirtual

Definition at line 41 of file FPGATrackSimPhiRoadFilterTool.cxx.

42 {
43  // Retrieve info
44  ATH_CHECK(m_FPGATrackSimMapping.retrieve());
45  m_nLayers = m_FPGATrackSimMapping->PlaneMap_1st()->getNLogiLayers();
46  return StatusCode::SUCCESS;
47 }

Member Data Documentation

◆ m_event

unsigned FPGATrackSimPhiRoadFilterTool::m_event = 0
private

Definition at line 79 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_EvtSel

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

Definition at line 58 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_fieldCorrection

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

Definition at line 66 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_FPGATrackSimMapping

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

Definition at line 57 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_name

std::string FPGATrackSimPhiRoadFilterTool::m_name
private

Definition at line 80 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_nLayers

unsigned FPGATrackSimPhiRoadFilterTool::m_nLayers = 0U
private

Definition at line 74 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_postfilter_roads

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

Definition at line 70 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 65 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_threshold

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

Definition at line 63 of file FPGATrackSimPhiRoadFilterTool.h.

◆ 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 64 of file FPGATrackSimPhiRoadFilterTool.h.


The documentation for this class was generated from the following files:
beamspotman.r
def r
Definition: beamspotman.py:676
FPGATrackSimRoad::getHitLayers
layer_bitmask_t getHitLayers() const
Definition: FPGATrackSimRoad.h:82
getMenu.algname
algname
Definition: getMenu.py:53
FPGATrackSimPhiRoadFilterTool::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimPhiRoadFilterTool.h:58
FPGATrackSimHoughTransformTool::fieldCorrection
static double fieldCorrection(unsigned region, double y, double r)
Definition: FPGATrackSimHoughTransformTool.cxx:301
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
FPGATrackSimPhiRoadFilterTool::m_ptscaling
Gaudi::Property< float > m_ptscaling
Definition: FPGATrackSimPhiRoadFilterTool.h:65
FPGATrackSimPhiRoadFilterTool::buildRoad
FPGATrackSimRoad buildRoad(FPGATrackSimRoad *origr) const
Definition: FPGATrackSimPhiRoadFilterTool.cxx:86
FPGATrackSimRoad::getHits
std::vector< const FPGATrackSimHit * > const & getHits(size_t layer) const
Definition: FPGATrackSimRoad.h:87
FPGATrackSimRoad::getX
float getX() const
Definition: FPGATrackSimRoad.h:74
FPGATrackSimHit
Definition: FPGATrackSimHit.h:38
HitType::wildcard
@ wildcard
FPGATrackSimHit::setDetType
void setDetType(SiliconTech detType)
Definition: FPGATrackSimHit.h:52
FPGATrackSimPhiRoadFilterTool::m_window
Gaudi::Property< std::vector< float > > m_window
Definition: FPGATrackSimPhiRoadFilterTool.h:64
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimPhiRoadFilterTool::m_event
unsigned m_event
Definition: FPGATrackSimPhiRoadFilterTool.h:79
FPGATrackSimPhiRoadFilterTool::m_postfilter_roads
std::vector< FPGATrackSimRoad > m_postfilter_roads
Definition: FPGATrackSimPhiRoadFilterTool.h:70
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
FPGATrackSimPhiRoadFilterTool::m_threshold
Gaudi::Property< unsigned > m_threshold
Definition: FPGATrackSimPhiRoadFilterTool.h:63
FPGATrackSimPhiRoadFilterTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimPhiRoadFilterTool.h:57
FPGATrackSimPhiRoadFilterTool::m_name
std::string m_name
Definition: FPGATrackSimPhiRoadFilterTool.h:80
FPGATrackSimRoad::getY
float getY() const
Definition: FPGATrackSimRoad.h:75
FPGATrackSimHit::setLayer
void setLayer(unsigned v)
Definition: FPGATrackSimHit.h:87
layer_bitmask_t
uint32_t layer_bitmask_t
Definition: FPGATrackSimTypes.h:22
FPGATrackSimPhiRoadFilterTool::m_fieldCorrection
Gaudi::Property< bool > m_fieldCorrection
Definition: FPGATrackSimPhiRoadFilterTool.h:66
FPGATrackSimPhiRoadFilterTool::m_nLayers
unsigned m_nLayers
Definition: FPGATrackSimPhiRoadFilterTool.h:74
FPGATrackSimRoad
Definition: FPGATrackSimRoad.h:29
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:51