Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 (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", "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),
35  m_name(instance_name(name))
36 {
37 }

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>();
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 }

◆ 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(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 }

◆ initialize()

StatusCode FPGATrackSimPhiRoadFilterTool::initialize ( )
overridevirtual

Definition at line 40 of file FPGATrackSimPhiRoadFilterTool.cxx.

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

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", "FPGATrackSimEventSelectionSvc"}
private

Definition at line 59 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_fieldCorrection

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

Definition at line 67 of file FPGATrackSimPhiRoadFilterTool.h.

◆ m_FPGATrackSimMapping

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

Definition at line 58 of file FPGATrackSimPhiRoadFilterTool.h.

◆ 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.

◆ 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.

◆ 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.


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:95
getMenu.algname
algname
Definition: getMenu.py:54
FPGATrackSimPhiRoadFilterTool::m_EvtSel
ServiceHandle< IFPGATrackSimEventSelectionSvc > m_EvtSel
Definition: FPGATrackSimPhiRoadFilterTool.h:59
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
FPGATrackSimPhiRoadFilterTool::m_ptscaling
Gaudi::Property< float > m_ptscaling
Definition: FPGATrackSimPhiRoadFilterTool.h:66
FPGATrackSimRoad::getHits
const std::vector< std::shared_ptr< const FPGATrackSimHit > > & getHits(size_t layer) const
Definition: FPGATrackSimRoad.h:100
FPGATrackSimRoad::getX
float getX() const
Definition: FPGATrackSimRoad.h:87
HitType::wildcard
@ wildcard
FPGATrackSimHit::setDetType
void setDetType(SiliconTech detType)
Definition: FPGATrackSimHit.h:55
FPGATrackSimPhiRoadFilterTool::m_window
Gaudi::Property< std::vector< float > > m_window
Definition: FPGATrackSimPhiRoadFilterTool.h:65
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
FPGATrackSimPhiRoadFilterTool::m_event
unsigned m_event
Definition: FPGATrackSimPhiRoadFilterTool.h:80
fieldCorrection
double fieldCorrection(unsigned region, double qpt, double r)
Definition: FPGATrackSimFunctions.cxx:163
FPGATrackSimPhiRoadFilterTool::m_postfilter_roads
std::vector< FPGATrackSimRoad > m_postfilter_roads
Definition: FPGATrackSimPhiRoadFilterTool.h:71
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
FPGATrackSimPhiRoadFilterTool::m_threshold
Gaudi::Property< unsigned > m_threshold
Definition: FPGATrackSimPhiRoadFilterTool.h:64
FPGATrackSimPhiRoadFilterTool::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimPhiRoadFilterTool.h:58
FPGATrackSimPhiRoadFilterTool::m_name
std::string m_name
Definition: FPGATrackSimPhiRoadFilterTool.h:81
FPGATrackSimRoad::getY
float getY() const
Definition: FPGATrackSimRoad.h:88
FPGATrackSimHit::setLayer
void setLayer(unsigned v)
Definition: FPGATrackSimHit.h:92
layer_bitmask_t
uint32_t layer_bitmask_t
Definition: FPGATrackSimTypes.h:22
FPGATrackSimPhiRoadFilterTool::m_fieldCorrection
Gaudi::Property< bool > m_fieldCorrection
Definition: FPGATrackSimPhiRoadFilterTool.h:67
FPGATrackSimPhiRoadFilterTool::m_nLayers
unsigned m_nLayers
Definition: FPGATrackSimPhiRoadFilterTool.h:75
FPGATrackSimRoad
Definition: FPGATrackSimRoad.h:31
FPGATrackSimPhiRoadFilterTool::buildRoad
FPGATrackSimRoad buildRoad(std::shared_ptr< const FPGATrackSimRoad > origr) const
Definition: FPGATrackSimPhiRoadFilterTool.cxx:85
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:54