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

#include <FPGATrackSimTrackingToolBase.h>

Inheritance diagram for FPGATrackSimTrackingToolBase:
Collaboration diagram for FPGATrackSimTrackingToolBase:

Public Member Functions

 FPGATrackSimTrackingToolBase (const std::string &type, const std::string &name, const IInterface *parent)
StatusCode setRoadSectors (std::vector< std::shared_ptr< const FPGATrackSimRoad > > &roads)
void matchIdealGeoSector (FPGATrackSimRoad &r)

Protected Attributes

ServiceHandle< IFPGATrackSimMappingSvcm_FPGATrackSimMapping { this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc" }
ServiceHandle< IFPGATrackSimBankSvcm_FPGATrackSimBank { this,"FPGATrackSimBankSvc","FPGATrackSimBankSvc" }
ToolHandle< IFPGATrackSimRoadFilterToolm_spRoadFilterTool {this, "SPRoadFilterTool", "FPGATrackSimSpacepointRoadFilterTool", "Spacepoint Road Filter Tool"}
Gaudi::Property< bool > m_doRegionalMapping { this, "RegionalMapping", false, "Use the sub-region maps to define the sector" }
Gaudi::Property< bool > m_doEtaPatternConsts { this, "doEtaPatternConsts", false, "Whether to use the eta pattern tool for constant generation" }
Gaudi::Property< bool > m_useSpacePoints { this, "useSpacePoints", false, "Whether we are using spacepoints." }
Gaudi::Property< bool > m_useSectors { this, "useSectors", false, "Will reverse calculate the sector for track-fitting purposes" }
Gaudi::Property< bool > m_idealGeoRoads { this, "IdealGeoRoads", true, "Set sectors to use ideal geometry fit constants" }
Gaudi::Property< bool > m_isSecondStage { this, "isSecondStage", true, "Is this the second stage?" }
Gaudi::Property< bool > m_do2ndStage {this, "Do2ndStageTrackFit", false, "Do 2nd stage track fit"}

Detailed Description

Definition at line 21 of file FPGATrackSimTrackingToolBase.h.

Constructor & Destructor Documentation

◆ FPGATrackSimTrackingToolBase()

FPGATrackSimTrackingToolBase::FPGATrackSimTrackingToolBase ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 6 of file FPGATrackSimTrackingToolBase.cxx.

7 : base_class(type, name, parent)
8{
9}

Member Function Documentation

◆ matchIdealGeoSector()

void FPGATrackSimTrackingToolBase::matchIdealGeoSector ( FPGATrackSimRoad & r)

Definition at line 36 of file FPGATrackSimTrackingToolBase.cxx.

37{
38 // We now look up the binning information in the sector bank.
39 const FPGATrackSimSectorBank* sectorbank = nullptr;
40 if(! m_do2ndStage)
41 sectorbank = m_FPGATrackSimBank->SectorBank_1st();
42 else
43 sectorbank = m_FPGATrackSimBank->SectorBank_2nd();
44
45 // Look up q/pt (or |q/pt|) from the Hough road, convert to MeV.
46 double qoverpt = r.getY()*0.001;
47 if (sectorbank->isAbsQOverPtBinning()) {
48 qoverpt = std::abs(qoverpt);
49 }
50
51 // Retrieve the bin boundaries from the sector bank; map this onto them.
52 const std::vector<double> &qoverpt_bins = sectorbank->getQOverPtBins();
53 auto bounds = std::equal_range(qoverpt_bins.begin(), qoverpt_bins.end(), qoverpt);
54
55 // estimate sectorbin
56 int sectorbin = fpgatracksim::QPT_SECTOR_OFFSET * (bounds.first - qoverpt_bins.begin() - 1);
57 sectorbin = std::clamp(sectorbin, 0, 10 * static_cast<int>(qoverpt_bins.size() - 2));
58 if (m_do2ndStage) sectorbin = 0;
59
61 int subregion = r.getSubRegion();
62 sectorbin += subregion*fpgatracksim::SUBREGION_SECTOR_OFFSET;
63 }
64
65 std::vector<module_t> modules(r.getNLayers(), -1);
66 layer_bitmask_t wc_layers = r.getWCLayers();
67 for (unsigned int il = 0; il < r.getNLayers(); il++) {
68 if (r.getNHits_layer()[il] == 0) {
69
70 // set corresponding bit to 1 in case of wc in the current layer
71 wc_layers |= (0x1 << il);
72
73 std::unique_ptr<FPGATrackSimHit> wcHit = std::make_unique<FPGATrackSimHit>();
74 wcHit->setHitType(HitType::wildcard);
75 wcHit->setLayer(il);
76 if(! m_do2ndStage)
77 wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st(0)->getDetType(il));
78 else
79 wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_2nd(0)->getDetType(il));
80
81 // Now store wc hit in a "std::vector<std::shared_ptr<const FPGATrackSimHit>>" format.
82 // We can probably avoid initializing an intermediate variable wcHits as we used to do
83 r.setHits(il,{std::move(wcHit)});
84 }
85 else {
86 modules[il]= sectorbin;
87 }
88 }
89 r.setWCLayers(wc_layers);
90
91
92 // If we are using eta patterns. We need to first run the roads through the road filter.
93 // Then the filter will be responsible for setting the actual sector.
94 // As a hack, we can store the sector bin ID in the road for now.
95 // This is fragile! If we want to store a different ID for each layer, it will break.
96
97 // Similarly, we do the same thing for spacepoints. this probably means we can't combine the two.
98 // maybe better to store the module array instead of just a number?
99
100 r.setSectorBin(sectorbin);
102 r.setSector(sectorbank->findSector(modules));
103 }
104}
uint32_t layer_bitmask_t
const std::vector< double > & getQOverPtBins() const
sector_t findSector(std::vector< module_t > const &modules) const
ServiceHandle< IFPGATrackSimBankSvc > m_FPGATrackSimBank
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
int r
Definition globals.cxx:22
constexpr int QPT_SECTOR_OFFSET
constexpr int SUBREGION_SECTOR_OFFSET

◆ setRoadSectors()

StatusCode FPGATrackSimTrackingToolBase::setRoadSectors ( std::vector< std::shared_ptr< const FPGATrackSimRoad > > & roads)

Definition at line 11 of file FPGATrackSimTrackingToolBase.cxx.

12{
13 for (auto& road: roads)
14 {
15 std::shared_ptr<FPGATrackSimRoad> nonConstRoad = std::const_pointer_cast<FPGATrackSimRoad>(road);
16 if (m_useSectors) {
17 if(! m_do2ndStage)
18 nonConstRoad->setSector(m_FPGATrackSimBank->SectorBank_1st()->findSector(nonConstRoad->getAllHits()));
19 else
20 nonConstRoad->setSector(m_FPGATrackSimBank->SectorBank_2nd()->findSector(nonConstRoad->getAllHits()));
21 }
22 else if (m_idealGeoRoads) matchIdealGeoSector(*nonConstRoad);
23 }
24 // Spacepoint road filter tool. Needed when fitting to spacepoints.
26 {
27 std::vector<std::shared_ptr<const FPGATrackSimRoad>> postfilter_roads;
28 ATH_CHECK(m_spRoadFilterTool->filterRoads(roads, postfilter_roads));
29 roads = std::move(postfilter_roads);
30 }
31 return StatusCode::SUCCESS;
32}
#define ATH_CHECK
Evaluate an expression and check for errors.
ToolHandle< IFPGATrackSimRoadFilterTool > m_spRoadFilterTool
void matchIdealGeoSector(FPGATrackSimRoad &r)

Member Data Documentation

◆ m_do2ndStage

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_do2ndStage {this, "Do2ndStageTrackFit", false, "Do 2nd stage track fit"}
protected

Definition at line 40 of file FPGATrackSimTrackingToolBase.h.

40{this, "Do2ndStageTrackFit", false, "Do 2nd stage track fit"};

◆ m_doEtaPatternConsts

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_doEtaPatternConsts { this, "doEtaPatternConsts", false, "Whether to use the eta pattern tool for constant generation" }
protected

Definition at line 35 of file FPGATrackSimTrackingToolBase.h.

35{ this, "doEtaPatternConsts", false, "Whether to use the eta pattern tool for constant generation" };

◆ m_doRegionalMapping

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_doRegionalMapping { this, "RegionalMapping", false, "Use the sub-region maps to define the sector" }
protected

Definition at line 34 of file FPGATrackSimTrackingToolBase.h.

34{ this, "RegionalMapping", false, "Use the sub-region maps to define the sector" };

◆ m_FPGATrackSimBank

ServiceHandle<IFPGATrackSimBankSvc> FPGATrackSimTrackingToolBase::m_FPGATrackSimBank { this,"FPGATrackSimBankSvc","FPGATrackSimBankSvc" }
protected

Definition at line 30 of file FPGATrackSimTrackingToolBase.h.

30{ this,"FPGATrackSimBankSvc","FPGATrackSimBankSvc" };

◆ m_FPGATrackSimMapping

ServiceHandle<IFPGATrackSimMappingSvc> FPGATrackSimTrackingToolBase::m_FPGATrackSimMapping { this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc" }
protected

Definition at line 29 of file FPGATrackSimTrackingToolBase.h.

29{ this,"FPGATrackSimMappingSvc","FPGATrackSimMappingSvc" };

◆ m_idealGeoRoads

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_idealGeoRoads { this, "IdealGeoRoads", true, "Set sectors to use ideal geometry fit constants" }
protected

Definition at line 38 of file FPGATrackSimTrackingToolBase.h.

38{ this, "IdealGeoRoads", true, "Set sectors to use ideal geometry fit constants" };

◆ m_isSecondStage

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_isSecondStage { this, "isSecondStage", true, "Is this the second stage?" }
protected

Definition at line 39 of file FPGATrackSimTrackingToolBase.h.

39{ this, "isSecondStage", true, "Is this the second stage?" };

◆ m_spRoadFilterTool

ToolHandle<IFPGATrackSimRoadFilterTool> FPGATrackSimTrackingToolBase::m_spRoadFilterTool {this, "SPRoadFilterTool", "FPGATrackSimSpacepointRoadFilterTool", "Spacepoint Road Filter Tool"}
protected

Definition at line 32 of file FPGATrackSimTrackingToolBase.h.

32{this, "SPRoadFilterTool", "FPGATrackSimSpacepointRoadFilterTool", "Spacepoint Road Filter Tool"};

◆ m_useSectors

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_useSectors { this, "useSectors", false, "Will reverse calculate the sector for track-fitting purposes" }
protected

Definition at line 37 of file FPGATrackSimTrackingToolBase.h.

37{ this, "useSectors", false, "Will reverse calculate the sector for track-fitting purposes" };

◆ m_useSpacePoints

Gaudi::Property<bool> FPGATrackSimTrackingToolBase::m_useSpacePoints { this, "useSpacePoints", false, "Whether we are using spacepoints." }
protected

Definition at line 36 of file FPGATrackSimTrackingToolBase.h.

36{ this, "useSpacePoints", false, "Whether we are using spacepoints." };

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