ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
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, "IdealGeoRoads", true, "Set sectors to use ideal geometry fit constants" }
 
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 
60  int subregion = r.getSubRegion();
61  sectorbin += subregion*fpgatracksim::SUBREGION_SECTOR_OFFSET;
62  }
63 
64  std::vector<module_t> modules(r.getNLayers(), -1);
65  layer_bitmask_t wc_layers = r.getWCLayers();
66  for (unsigned int il = 0; il < r.getNLayers(); il++) {
67  if (r.getNHits_layer()[il] == 0) {
68 
69  // set corresponding bit to 1 in case of wc in the current layer
70  wc_layers |= (0x1 << il);
71 
72  std::unique_ptr<FPGATrackSimHit> wcHit = std::make_unique<FPGATrackSimHit>();
74  wcHit->setLayer(il);
75  if(! m_do2ndStage)
76  wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_1st(0)->getDetType(il));
77  else
78  wcHit->setDetType(m_FPGATrackSimMapping->PlaneMap_2nd(0)->getDetType(il));
79 
80  // Now store wc hit in a "std::vector<std::shared_ptr<const FPGATrackSimHit>>" format.
81  // We can probably avoid initializing an intermediate variable wcHits as we used to do
82  r.setHits(il,{std::move(wcHit)});
83  }
84  else {
85  modules[il]= sectorbin;
86  }
87  }
88  r.setWCLayers(wc_layers);
89 
90 
91  // If we are using eta patterns. We need to first run the roads through the road filter.
92  // Then the filter will be responsible for setting the actual sector.
93  // As a hack, we can store the sector bin ID in the road for now.
94  // This is fragile! If we want to store a different ID for each layer, it will break.
95 
96  // Similarly, we do the same thing for spacepoints. this probably means we can't combine the two.
97  // maybe better to store the module array instead of just a number?
98 
99  r.setSectorBin(sectorbin);
101  r.setSector(sectorbank->findSector(modules));
102  }
103 }

◆ 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.
25  if (m_useSpacePoints)
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 }

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.

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

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

◆ m_FPGATrackSimBank

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

Definition at line 30 of file FPGATrackSimTrackingToolBase.h.

◆ m_FPGATrackSimMapping

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

Definition at line 29 of file FPGATrackSimTrackingToolBase.h.

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

◆ m_isSecondStage

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

Definition at line 39 of file FPGATrackSimTrackingToolBase.h.

◆ m_spRoadFilterTool

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

Definition at line 32 of file FPGATrackSimTrackingToolBase.h.

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

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


The documentation for this class was generated from the following files:
fpgatracksim::SUBREGION_SECTOR_OFFSET
constexpr int SUBREGION_SECTOR_OFFSET
Definition: FPGATrackSimConstants.h:24
PlotCalibFromCool.il
il
Definition: PlotCalibFromCool.py:381
beamspotman.r
def r
Definition: beamspotman.py:676
FPGATrackSimTrackingToolBase::m_FPGATrackSimBank
ServiceHandle< IFPGATrackSimBankSvc > m_FPGATrackSimBank
Definition: FPGATrackSimTrackingToolBase.h:30
FPGATrackSimTrackingToolBase::m_doRegionalMapping
Gaudi::Property< bool > m_doRegionalMapping
Definition: FPGATrackSimTrackingToolBase.h:34
FPGATrackSimSectorBank::getQOverPtBins
const std::vector< double > & getQOverPtBins() const
Definition: FPGATrackSimSectorBank.h:52
HitType::wildcard
@ wildcard
FPGATrackSimTrackingToolBase::matchIdealGeoSector
void matchIdealGeoSector(FPGATrackSimRoad &r)
Definition: FPGATrackSimTrackingToolBase.cxx:36
FPGATrackSimHit::setDetType
void setDetType(SiliconTech detType)
Definition: FPGATrackSimHit.h:55
FPGATrackSimSectorBank::findSector
sector_t findSector(std::vector< module_t > const &modules) const
Definition: FPGATrackSimSectorBank.cxx:121
FPGATrackSimTrackingToolBase::m_FPGATrackSimMapping
ServiceHandle< IFPGATrackSimMappingSvc > m_FPGATrackSimMapping
Definition: FPGATrackSimTrackingToolBase.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
FPGATrackSimSectorBank
Definition: FPGATrackSimSectorBank.h:32
FPGATrackSimTrackingToolBase::m_useSpacePoints
Gaudi::Property< bool > m_useSpacePoints
Definition: FPGATrackSimTrackingToolBase.h:36
fpgatracksim::QPT_SECTOR_OFFSET
constexpr int QPT_SECTOR_OFFSET
Definition: FPGATrackSimConstants.h:23
FPGATrackSimTrackingToolBase::m_idealGeoRoads
Gaudi::Property< bool > m_idealGeoRoads
Definition: FPGATrackSimTrackingToolBase.h:38
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
FPGATrackSimTrackingToolBase::m_useSectors
Gaudi::Property< bool > m_useSectors
Definition: FPGATrackSimTrackingToolBase.h:37
FPGATrackSimHit::setLayer
void setLayer(unsigned v)
Definition: FPGATrackSimHit.h:92
FPGATrackSimRoad::setSector
void setSector(sector_t sector)
Definition: FPGATrackSimRoad.h:59
layer_bitmask_t
uint32_t layer_bitmask_t
Definition: FPGATrackSimTypes.h:22
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
FPGATrackSimSectorBank::isAbsQOverPtBinning
bool isAbsQOverPtBinning() const
Definition: FPGATrackSimSectorBank.h:54
FPGATrackSimTrackingToolBase::m_doEtaPatternConsts
Gaudi::Property< bool > m_doEtaPatternConsts
Definition: FPGATrackSimTrackingToolBase.h:35
FPGATrackSimRoad::getAllHits
const std::vector< std::vector< std::shared_ptr< const FPGATrackSimHit > > > & getAllHits() const
Definition: FPGATrackSimRoad.h:100
FPGATrackSimTrackingToolBase::m_do2ndStage
Gaudi::Property< bool > m_do2ndStage
Definition: FPGATrackSimTrackingToolBase.h:40
FPGATrackSimTrackingToolBase::m_spRoadFilterTool
ToolHandle< IFPGATrackSimRoadFilterTool > m_spRoadFilterTool
Definition: FPGATrackSimTrackingToolBase.h:32
FPGATrackSimHit::setHitType
void setHitType(HitType type)
Definition: FPGATrackSimHit.h:54